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

Side by Side Diff: chrome/browser/chrome_content_browser_client_browsertest.cc

Issue 24733003: Update defaults for InstantExtended. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More test fixes. Created 7 years, 2 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 | Annotate | Revision Log
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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/metrics/field_trial.h" 6 #include "base/metrics/field_trial.h"
7 #include "chrome/browser/search/search.h"
8 #include "chrome/browser/search_engines/template_url_service.h" 7 #include "chrome/browser/search_engines/template_url_service.h"
9 #include "chrome/browser/search_engines/template_url_service_factory.h" 8 #include "chrome/browser/search_engines/template_url_service_factory.h"
10 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/tabs/tab_strip_model.h" 10 #include "chrome/browser/ui/tabs/tab_strip_model.h"
12 #include "chrome/common/chrome_switches.h" 11 #include "chrome/common/chrome_switches.h"
13 #include "chrome/test/base/in_process_browser_test.h" 12 #include "chrome/test/base/in_process_browser_test.h"
14 #include "chrome/test/base/ui_test_utils.h" 13 #include "chrome/test/base/ui_test_utils.h"
15 #include "content/public/browser/navigation_controller.h" 14 #include "content/public/browser/navigation_controller.h"
16 #include "content/public/browser/navigation_entry.h" 15 #include "content/public/browser/navigation_entry.h"
17 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 EXPECT_EQ(url, entry->GetVirtualURL()); 93 EXPECT_EQ(url, entry->GetVirtualURL());
95 } 94 }
96 95
97 IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest, 96 IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest,
98 UberURLHandler_InstantExtendedNewTabPage) { 97 UberURLHandler_InstantExtendedNewTabPage) {
99 const GURL url_original("chrome://newtab"); 98 const GURL url_original("chrome://newtab");
100 const GURL url_rewritten("http://example.com/newtab"); 99 const GURL url_rewritten("http://example.com/newtab");
101 InstallTemplateURLWithNewTabPage(url_rewritten); 100 InstallTemplateURLWithNewTabPage(url_rewritten);
102 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended", 101 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended",
103 "Group1 use_cacheable_ntp:1")); 102 "Group1 use_cacheable_ntp:1"));
104 chrome::EnableInstantExtendedAPIForTesting();
105 103
106 ui_test_utils::NavigateToURL(browser(), url_original); 104 ui_test_utils::NavigateToURL(browser(), url_original);
107 NavigationEntry* entry = GetLastCommittedEntry(); 105 NavigationEntry* entry = GetLastCommittedEntry();
108 106
109 ASSERT_TRUE(entry != NULL); 107 ASSERT_TRUE(entry != NULL);
110 EXPECT_EQ(url_rewritten, entry->GetURL()); 108 EXPECT_EQ(url_rewritten, entry->GetURL());
111 EXPECT_EQ(url_original, entry->GetVirtualURL()); 109 EXPECT_EQ(url_original, entry->GetVirtualURL());
112 } 110 }
113 111
114 IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest,
115 UberURLHandler_InstantExtendedNewTabPageDisabled) {
116 const GURL url_original("chrome://newtab");
117 const GURL url_rewritten("http://example.com/newtab");
118 InstallTemplateURLWithNewTabPage(url_rewritten);
119 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended",
120 "Group1 use_cacheable_ntp:1"));
121 chrome::DisableInstantExtendedAPIForTesting();
122
123 ui_test_utils::NavigateToURL(browser(), url_original);
124 NavigationEntry* entry = GetLastCommittedEntry();
125
126 ASSERT_TRUE(entry != NULL);
127 EXPECT_EQ(url_original, entry->GetURL());
128 EXPECT_EQ(url_original, entry->GetVirtualURL());
129 }
130
131 // Test that a basic navigation works in --site-per-process mode. This prevents 112 // Test that a basic navigation works in --site-per-process mode. This prevents
132 // regressions when that mode calls out into the ChromeContentBrowserClient, 113 // regressions when that mode calls out into the ChromeContentBrowserClient,
133 // such as http://crbug.com/164223. 114 // such as http://crbug.com/164223.
134 IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest, 115 IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest,
135 SitePerProcessNavigation) { 116 SitePerProcessNavigation) {
136 CommandLine::ForCurrentProcess()->AppendSwitch( 117 CommandLine::ForCurrentProcess()->AppendSwitch(
137 switches::kSitePerProcess); 118 switches::kSitePerProcess);
138 ASSERT_TRUE(test_server()->Start()); 119 ASSERT_TRUE(test_server()->Start());
139 const GURL url(test_server()->GetURL("files/title1.html")); 120 const GURL url(test_server()->GetURL("files/title1.html"));
140 121
141 ui_test_utils::NavigateToURL(browser(), url); 122 ui_test_utils::NavigateToURL(browser(), url);
142 NavigationEntry* entry = GetLastCommittedEntry(); 123 NavigationEntry* entry = GetLastCommittedEntry();
143 124
144 ASSERT_TRUE(entry != NULL); 125 ASSERT_TRUE(entry != NULL);
145 EXPECT_EQ(url, entry->GetURL()); 126 EXPECT_EQ(url, entry->GetURL());
146 EXPECT_EQ(url, entry->GetVirtualURL()); 127 EXPECT_EQ(url, entry->GetVirtualURL());
147 } 128 }
148 129
149 } // namespace content 130 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698