Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: chrome/browser/apps/app_url_redirector_browsertest.cc

Issue 2537503002: [Prerender] Get the prerender mode from Finch field trial. (Closed)
Patch Set: cleanup Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/chrome_browser_field_trials.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/strings/stringprintf.h" 5 #include "base/strings/stringprintf.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "base/win/windows_version.h" 7 #include "base/win/windows_version.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "chrome/browser/apps/app_browsertest_util.h" 9 #include "chrome/browser/apps/app_browsertest_util.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
11 #include "chrome/browser/prerender/prerender_manager.h"
11 #include "chrome/browser/ui/browser_navigator_params.h" 12 #include "chrome/browser/ui/browser_navigator_params.h"
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" 13 #include "chrome/browser/ui/tabs/tab_strip_model.h"
13 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
14 #include "chrome/test/base/ui_test_utils.h" 15 #include "chrome/test/base/ui_test_utils.h"
15 #include "content/public/test/browser_test_base.h" 16 #include "content/public/test/browser_test_base.h"
16 #include "content/public/test/browser_test_utils.h" 17 #include "content/public/test/browser_test_utils.h"
17 #include "extensions/test/extension_test_message_listener.h" 18 #include "extensions/test/extension_test_message_listener.h"
18 #include "net/test/embedded_test_server/embedded_test_server.h" 19 #include "net/test/embedded_test_server/embedded_test_server.h"
19 #include "ui/base/page_transition_types.h" 20 #include "ui/base/page_transition_types.h"
20 21
21 namespace extensions { 22 namespace extensions {
22 23
23 class PlatformAppUrlRedirectorBrowserTest : public PlatformAppBrowserTest { 24 class PlatformAppUrlRedirectorBrowserTest : public PlatformAppBrowserTest {
24 public: 25 public:
25 void SetUpCommandLine(base::CommandLine* command_line) override; 26 void SetUpCommandLine(base::CommandLine* command_line) override;
27 void SetUpOnMainThread() override;
26 28
27 protected: 29 protected:
28 // Performs the following sequence: 30 // Performs the following sequence:
29 // - installs the app |handler| (a relative path under the platform_apps 31 // - installs the app |handler| (a relative path under the platform_apps
30 // subdirectory); 32 // subdirectory);
31 // - navigates the current tab to the HTML page |lancher_page| (ditto); 33 // - navigates the current tab to the HTML page |lancher_page| (ditto);
32 // - then waits for |handler| to launch and send back a |handler_ack_message|; 34 // - then waits for |handler| to launch and send back a |handler_ack_message|;
33 // - finally checks that the resulting app window count is as expected. 35 // - finally checks that the resulting app window count is as expected.
34 // The |launcher_page| is supposed to trigger a navigation matching one of the 36 // The |launcher_page| is supposed to trigger a navigation matching one of the
35 // url_handlers in the |handler|'s manifest, and thereby launch the |handler|. 37 // url_handlers in the |handler|'s manifest, and thereby launch the |handler|.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 void TestMismatchingNavigationInBrowser(const char* mismatching_target_page, 113 void TestMismatchingNavigationInBrowser(const char* mismatching_target_page,
112 ui::PageTransition transition, 114 ui::PageTransition transition,
113 const char* success_tab_title, 115 const char* success_tab_title,
114 const char* handler); 116 const char* handler);
115 }; 117 };
116 118
117 void PlatformAppUrlRedirectorBrowserTest::SetUpCommandLine( 119 void PlatformAppUrlRedirectorBrowserTest::SetUpCommandLine(
118 base::CommandLine* command_line) { 120 base::CommandLine* command_line) {
119 PlatformAppBrowserTest::SetUpCommandLine(command_line); 121 PlatformAppBrowserTest::SetUpCommandLine(command_line);
120 command_line->AppendSwitch(::switches::kDisablePopupBlocking); 122 command_line->AppendSwitch(::switches::kDisablePopupBlocking);
121 command_line->AppendSwitchASCII(::switches::kPrerenderMode, 123 }
122 ::switches::kPrerenderModeSwitchValueEnabled); 124
125 void PlatformAppUrlRedirectorBrowserTest::SetUpOnMainThread() {
126 PlatformAppBrowserTest::SetUpOnMainThread();
127 prerender::PrerenderManager::SetMode(
128 prerender::PrerenderManager::PRERENDER_MODE_ENABLED);
123 } 129 }
124 130
125 // TODO(sergeygs): Factor out common functionality from TestXyz, 131 // TODO(sergeygs): Factor out common functionality from TestXyz,
126 // TestNegativeXyz, and TestMismatchingXyz versions. 132 // TestNegativeXyz, and TestMismatchingXyz versions.
127 133
128 // TODO(sergeys): Return testing::AssertionErrors from these methods to 134 // TODO(sergeys): Return testing::AssertionErrors from these methods to
129 // preserve line numbers and (if applicable) failure messages. 135 // preserve line numbers and (if applicable) failure messages.
130 136
131 void PlatformAppUrlRedirectorBrowserTest::TestNavigationInTab( 137 void PlatformAppUrlRedirectorBrowserTest::TestNavigationInTab(
132 const char* launcher_page, 138 const char* launcher_page,
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 #if defined (OS_WIN) 507 #if defined (OS_WIN)
502 if (base::win::GetVersion() < base::win::VERSION_VISTA) return; // Bug 301638 508 if (base::win::GetVersion() < base::win::VERSION_VISTA) return; // Bug 301638
503 #endif 509 #endif
504 TestNavigationInTab( 510 TestNavigationInTab(
505 "url_handlers/launching_pages/prerender_link.html", 511 "url_handlers/launching_pages/prerender_link.html",
506 "url_handlers/handlers/simple", 512 "url_handlers/handlers/simple",
507 "Handler launched"); 513 "Handler launched");
508 } 514 }
509 515
510 } // namespace extensions 516 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chrome_browser_field_trials.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698