Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / content / renderer / browser_render_view_browsertest.cc
index 57bb7a8..2c12bc7 100644 (file)
 #include "content/public/common/content_switches.h"
 #include "content/public/renderer/render_view.h"
 #include "content/public/test/browser_test_utils.h"
+#include "content/public/test/content_browser_test.h"
+#include "content/public/test/content_browser_test_utils.h"
 #include "content/public/test/test_utils.h"
 #include "content/shell/browser/shell.h"
 #include "content/shell/browser/shell_browser_context.h"
 #include "content/shell/browser/shell_content_browser_client.h"
 #include "content/shell/common/shell_content_client.h"
 #include "content/shell/renderer/shell_content_renderer_client.h"
-#include "content/test/content_browser_test.h"
-#include "content/test/content_browser_test_utils.h"
 #include "net/base/net_errors.h"
 #include "net/disk_cache/disk_cache.h"
 #include "net/http/failing_http_transaction_factory.h"
@@ -49,13 +49,12 @@ class TestShellContentRendererClient : public ShellContentRendererClient {
         latest_error_reason_(0),
         latest_error_stale_copy_in_cache_(false) {}
 
-  virtual void GetNavigationErrorStrings(
-      content::RenderView* render_view,
-      blink::WebFrame* frame,
-      const blink::WebURLRequest& failed_request,
-      const blink::WebURLError& error,
-      std::string* error_html,
-      base::string16* error_description) OVERRIDE {
+  void GetNavigationErrorStrings(content::RenderView* render_view,
+                                 blink::WebFrame* frame,
+                                 const blink::WebURLRequest& failed_request,
+                                 const blink::WebURLError& error,
+                                 std::string* error_html,
+                                 base::string16* error_description) override {
     if (error_html)
       *error_html = "A suffusion of yellow.";
     latest_error_valid_ = true;
@@ -88,8 +87,7 @@ void InterceptNetworkTransactions(net::URLRequestContextGetter* getter,
       new net::FailingHttpTransactionFactory(cache->GetSession(), error));
   // Throw away old version; since this is a browser test, there is no
   // need to restore the old state.
-  cache->SetHttpNetworkTransactionFactoryForTesting(
-      factory.PassAs<net::HttpTransactionFactory>());
+  cache->SetHttpNetworkTransactionFactoryForTesting(factory.Pass());
 }
 
 void CallOnUIThreadValidatingReturn(const base::Closure& callback,
@@ -137,21 +135,21 @@ void ClearCache(net::URLRequestContextGetter* getter,
 
 class RenderViewBrowserTest : public ContentBrowserTest {
  public:
-  RenderViewBrowserTest() : renderer_client_(NULL) {}
+  RenderViewBrowserTest() {}
 
-  virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
+  void SetUpCommandLine(CommandLine* command_line) override {
     // This method is needed to allow interaction with in-process renderer
     // and use of a test ContentRendererClient.
     command_line->AppendSwitch(switches::kSingleProcess);
   }
 
-  virtual void SetUp() OVERRIDE {
+  void SetUpOnMainThread() override {
     // Override setting of renderer client.
     renderer_client_ = new TestShellContentRendererClient();
-    SetContentRendererClient(
-        scoped_ptr<ContentRendererClient>(renderer_client_).Pass());
-
-    ContentBrowserTest::SetUp();
+    // Explicitly leaks ownership; this object will remain alive
+    // until process death.  We don't deleted the returned value,
+    // since some contexts set the pointer to a non-heap address.
+    SetRendererClientForTesting(renderer_client_);
   }
 
   // Navigates to the given URL and waits for |num_navigations| to occur, and
@@ -193,19 +191,10 @@ class RenderViewBrowserTest : public ContentBrowserTest {
         error_code, stale_cache_entry_present);
   }
 
-  // Actually owned by the superclass, so safe to keep a bare pointer.
   TestShellContentRendererClient* renderer_client_;
 };
 
-#if defined(OS_ANDROID)
-// Flaky https://crbug.com/341745
-#define MAYBE_ConfirmCacheInformationPlumbed DISABLED_ConfirmCacheInformationPlumbed
-#else
-#define MAYBE_ConfirmCacheInformationPlumbed ConfirmCacheInformationPlumbed
-#endif
-
-IN_PROC_BROWSER_TEST_F(RenderViewBrowserTest,
-                       MAYBE_ConfirmCacheInformationPlumbed) {
+IN_PROC_BROWSER_TEST_F(RenderViewBrowserTest, ConfirmCacheInformationPlumbed) {
   ASSERT_TRUE(test_server()->Start());
 
   // Load URL with "nocache" set, to create stale cache.