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

Side by Side Diff: chrome/browser/ui/login/login_handler_browsertest.cc

Issue 2754003006: Prerender: omnibox and instant field trial parameters. (Closed)
Patch Set: comments Created 3 years, 9 months 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 | « chrome/browser/prerender/prerender_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 #include <list> 6 #include <list>
7 #include <map> 7 #include <map>
8 8
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/chrome_notification_types.h" 11 #include "chrome/browser/chrome_notification_types.h"
12 #include "chrome/browser/prerender/prerender_manager.h" 12 #include "chrome/browser/prerender/prerender_manager.h"
13 #include "chrome/browser/prerender/prerender_origin.h"
13 #include "chrome/browser/ssl/ssl_blocking_page.h" 14 #include "chrome/browser/ssl/ssl_blocking_page.h"
14 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_commands.h" 16 #include "chrome/browser/ui/browser_commands.h"
16 #include "chrome/browser/ui/login/login_handler.h" 17 #include "chrome/browser/ui/login/login_handler.h"
17 #include "chrome/browser/ui/login/login_handler_test_utils.h" 18 #include "chrome/browser/ui/login/login_handler_test_utils.h"
18 #include "chrome/browser/ui/login/login_interstitial_delegate.h" 19 #include "chrome/browser/ui/login/login_interstitial_delegate.h"
19 #include "chrome/browser/ui/tabs/tab_strip_model.h" 20 #include "chrome/browser/ui/tabs/tab_strip_model.h"
20 #include "chrome/test/base/in_process_browser_test.h" 21 #include "chrome/test/base/in_process_browser_test.h"
21 #include "chrome/test/base/ui_test_utils.h" 22 #include "chrome/test/base/ui_test_utils.h"
22 #include "content/public/browser/interstitial_page.h" 23 #include "content/public/browser/interstitial_page.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // correctness. Instead, it relies on the auth dialog blocking the 125 // correctness. Instead, it relies on the auth dialog blocking the
125 // browser, and triggering a timeout to cause failure when the 126 // browser, and triggering a timeout to cause failure when the
126 // prefetch resource requires authorization. 127 // prefetch resource requires authorization.
127 IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, PrefetchAuthCancels) { 128 IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, PrefetchAuthCancels) {
128 ASSERT_TRUE(embedded_test_server()->Start()); 129 ASSERT_TRUE(embedded_test_server()->Start());
129 GURL test_page = embedded_test_server()->GetURL(kPrefetchAuthPage); 130 GURL test_page = embedded_test_server()->GetURL(kPrefetchAuthPage);
130 131
131 class SetPrefetchForTest { 132 class SetPrefetchForTest {
132 public: 133 public:
133 explicit SetPrefetchForTest(bool prefetch) 134 explicit SetPrefetchForTest(bool prefetch)
134 : old_prerender_mode_(prerender::PrerenderManager::GetMode()) { 135 : old_prerender_mode_(
136 prerender::PrerenderManager::GetMode(prerender::ORIGIN_NONE)) {
135 std::string exp_group = prefetch ? "ExperimentYes" : "ExperimentNo"; 137 std::string exp_group = prefetch ? "ExperimentYes" : "ExperimentNo";
136 base::FieldTrialList::CreateFieldTrial("Prefetch", exp_group); 138 base::FieldTrialList::CreateFieldTrial("Prefetch", exp_group);
137 // Disable prerender so this is just a prefetch of the top-level page. 139 // Disable prerender so this is just a prefetch of the top-level page.
138 prerender::PrerenderManager::SetMode( 140 prerender::PrerenderManager::SetMode(
139 prerender::PrerenderManager::PRERENDER_MODE_DISABLED); 141 prerender::PrerenderManager::PRERENDER_MODE_DISABLED);
140 } 142 }
141 143
142 ~SetPrefetchForTest() { 144 ~SetPrefetchForTest() {
143 prerender::PrerenderManager::SetMode(old_prerender_mode_); 145 prerender::PrerenderManager::SetMode(old_prerender_mode_);
144 } 146 }
(...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1495 // out. 1497 // out.
1496 EXPECT_TRUE( 1498 EXPECT_TRUE(
1497 WaitForRenderFrameReady(contents->GetInterstitialPage()->GetMainFrame())); 1499 WaitForRenderFrameReady(contents->GetInterstitialPage()->GetMainFrame()));
1498 EXPECT_TRUE(contents->ShowingInterstitialPage()); 1500 EXPECT_TRUE(contents->ShowingInterstitialPage());
1499 EXPECT_EQ(SSLBlockingPage::kTypeForTesting, contents->GetInterstitialPage() 1501 EXPECT_EQ(SSLBlockingPage::kTypeForTesting, contents->GetInterstitialPage()
1500 ->GetDelegateForTesting() 1502 ->GetDelegateForTesting()
1501 ->GetTypeForTesting()); 1503 ->GetTypeForTesting());
1502 } 1504 }
1503 1505
1504 } // namespace 1506 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698