OLD | NEW |
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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/compiler_specific.h" |
| 7 #include "base/path_service.h" |
6 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
7 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
8 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 11 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
10 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 12 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
11 #include "chrome/browser/google/google_util.h" | 13 #include "chrome/browser/google/google_util.h" |
12 #include "chrome/browser/net/url_request_mock_util.h" | 14 #include "chrome/browser/net/url_request_mock_util.h" |
13 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_commands.h" | 17 #include "chrome/browser/ui/browser_commands.h" |
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 19 #include "chrome/common/chrome_paths.h" |
17 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
18 #include "chrome/test/base/in_process_browser_test.h" | 21 #include "chrome/test/base/in_process_browser_test.h" |
19 #include "chrome/test/base/ui_test_utils.h" | 22 #include "chrome/test/base/ui_test_utils.h" |
20 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
21 #include "content/public/browser/render_view_host.h" | 24 #include "content/public/browser/render_view_host.h" |
22 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
23 #include "content/public/browser/web_contents_observer.h" | 26 #include "content/public/browser/web_contents_observer.h" |
24 #include "content/public/test/browser_test_utils.h" | 27 #include "content/public/test/browser_test_utils.h" |
25 #include "content/public/test/test_navigation_observer.h" | 28 #include "content/public/test/test_navigation_observer.h" |
26 #include "content/test/net/url_request_failed_job.h" | 29 #include "content/test/net/url_request_failed_job.h" |
27 #include "content/test/net/url_request_mock_http_job.h" | 30 #include "content/test/net/url_request_mock_http_job.h" |
28 #include "net/base/net_errors.h" | 31 #include "net/base/net_errors.h" |
29 #include "net/base/net_util.h" | 32 #include "net/base/net_util.h" |
30 #include "net/http/failing_http_transaction_factory.h" | 33 #include "net/http/failing_http_transaction_factory.h" |
31 #include "net/http/http_cache.h" | 34 #include "net/http/http_cache.h" |
32 #include "net/test/spawned_test_server/spawned_test_server.h" | 35 #include "net/test/spawned_test_server/spawned_test_server.h" |
33 #include "net/url_request/url_request_context.h" | 36 #include "net/url_request/url_request_context.h" |
34 #include "net/url_request/url_request_context_getter.h" | 37 #include "net/url_request/url_request_context_getter.h" |
35 #include "net/url_request/url_request_filter.h" | 38 #include "net/url_request/url_request_filter.h" |
36 #include "net/url_request/url_request_job_factory.h" | 39 #include "net/url_request/url_request_job_factory.h" |
37 | 40 |
38 using content::BrowserThread; | 41 using content::BrowserThread; |
39 using content::NavigationController; | 42 using content::NavigationController; |
40 using content::URLRequestFailedJob; | 43 using content::URLRequestFailedJob; |
41 | 44 |
42 namespace { | 45 namespace { |
43 | 46 |
| 47 // Returns true if |text| is displayed on the page |browser| is currently |
| 48 // displaying. Uses "innerText", so will miss hidden text, and whitespace |
| 49 // space handling may be weird. |
| 50 bool WARN_UNUSED_RESULT IsDisplayingText(Browser* browser, |
| 51 const std::string& text) { |
| 52 std::string command = base::StringPrintf( |
| 53 "var textContent = document.body.innerText;" |
| 54 "var hasText = textContent.indexOf('%s') >= 0;" |
| 55 "domAutomationController.send(hasText);", |
| 56 text.c_str()); |
| 57 bool result = false; |
| 58 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
| 59 browser->tab_strip_model()->GetActiveWebContents(), command, &result)); |
| 60 return result; |
| 61 } |
| 62 |
| 63 // Expands the more box on the currently displayed error page. |
| 64 void ToggleHelpBox(Browser* browser) { |
| 65 EXPECT_TRUE(content::ExecuteScript( |
| 66 browser->tab_strip_model()->GetActiveWebContents(), |
| 67 "document.getElementById('more-less-button').click();")); |
| 68 } |
| 69 |
| 70 // Returns true if |browser| is displaying the text representation of |
| 71 // |error_code| on the current page. |
| 72 bool WARN_UNUSED_RESULT IsDisplayingNetError(Browser* browser, |
| 73 net::Error error_code) { |
| 74 // Get the error as a string, and remove the leading "net::", which is not |
| 75 // included on error pages. |
| 76 std::string error_string = net::ErrorToString(error_code); |
| 77 base::RemoveChars(error_string, "net:", &error_string); |
| 78 |
| 79 return IsDisplayingText(browser, error_string); |
| 80 } |
| 81 |
| 82 // Checks that the local error page is being displayed, without remotely |
| 83 // retrieved navigation corrections, and with the specified error code. |
| 84 void ExpectDisplayingLocalErrorPage(Browser* browser, net::Error error_code) { |
| 85 // Expand the help box so innerText will include text below the fold. |
| 86 ToggleHelpBox(browser); |
| 87 |
| 88 EXPECT_TRUE(IsDisplayingNetError(browser, error_code)); |
| 89 |
| 90 // Locally generated error pages should not have navigation corrections. |
| 91 EXPECT_FALSE(IsDisplayingText(browser, "http://correction1/")); |
| 92 EXPECT_FALSE(IsDisplayingText(browser, "http://correction2/")); |
| 93 |
| 94 // Locally generated error pages should not have a populated search box. |
| 95 bool search_box_populated = false; |
| 96 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
| 97 browser->tab_strip_model()->GetActiveWebContents(), |
| 98 "var searchText = document.getElementById('search-box').value;" |
| 99 "domAutomationController.send(searchText == 'search query');", |
| 100 &search_box_populated)); |
| 101 EXPECT_FALSE(search_box_populated); |
| 102 } |
| 103 |
| 104 // Checks that an error page with information retrieved from the navigation |
| 105 // correction service is being displayed, with the specified specified error |
| 106 // code. |
| 107 void ExpectDisplayingNavigationCorrections(Browser* browser, |
| 108 net::Error error_code) { |
| 109 // Expand the help box so innerText will include text below the fold. |
| 110 ToggleHelpBox(browser); |
| 111 |
| 112 EXPECT_TRUE(IsDisplayingNetError(browser, error_code)); |
| 113 |
| 114 // Check that the mock navigation corrections are displayed. |
| 115 EXPECT_TRUE(IsDisplayingText(browser, "http://correction1/")); |
| 116 EXPECT_TRUE(IsDisplayingText(browser, "http://correction2/")); |
| 117 |
| 118 // Check that the search box is populated correctly. |
| 119 bool search_box_populated = false; |
| 120 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
| 121 browser->tab_strip_model()->GetActiveWebContents(), |
| 122 "var searchText = document.getElementById('search-box').value;" |
| 123 "domAutomationController.send(searchText == 'search query');", |
| 124 &search_box_populated)); |
| 125 EXPECT_TRUE(search_box_populated); |
| 126 } |
| 127 |
44 class ErrorPageTest : public InProcessBrowserTest { | 128 class ErrorPageTest : public InProcessBrowserTest { |
45 public: | 129 public: |
46 enum HistoryNavigationDirection { | 130 enum HistoryNavigationDirection { |
47 HISTORY_NAVIGATE_BACK, | 131 HISTORY_NAVIGATE_BACK, |
48 HISTORY_NAVIGATE_FORWARD, | 132 HISTORY_NAVIGATE_FORWARD, |
49 }; | 133 }; |
50 | 134 |
51 // Navigates the active tab to a mock url created for the file at |file_path|. | 135 // Navigates the active tab to a mock url created for the file at |file_path|. |
52 void NavigateToFileURL(const base::FilePath::StringType& file_path) { | 136 void NavigateToFileURL(const base::FilePath::StringType& file_path) { |
53 ui_test_utils::NavigateToURL( | 137 ui_test_utils::NavigateToURL( |
(...skipping 28 matching lines...) Expand all Loading... |
82 | 166 |
83 // Navigates forward in the history and waits for |num_navigations| to occur, | 167 // Navigates forward in the history and waits for |num_navigations| to occur, |
84 // and the title to change to |expected_title|. | 168 // and the title to change to |expected_title|. |
85 void GoForwardAndWaitForTitle(const std::string& expected_title, | 169 void GoForwardAndWaitForTitle(const std::string& expected_title, |
86 int num_navigations) { | 170 int num_navigations) { |
87 NavigateHistoryAndWaitForTitle(expected_title, | 171 NavigateHistoryAndWaitForTitle(expected_title, |
88 num_navigations, | 172 num_navigations, |
89 HISTORY_NAVIGATE_FORWARD); | 173 HISTORY_NAVIGATE_FORWARD); |
90 } | 174 } |
91 | 175 |
| 176 void GoBackAndWaitForNavigations(int num_navigations) { |
| 177 NavigateHistory(num_navigations, HISTORY_NAVIGATE_BACK); |
| 178 } |
| 179 |
| 180 void GoForwardAndWaitForNavigations(int num_navigations) { |
| 181 NavigateHistory(num_navigations, HISTORY_NAVIGATE_FORWARD); |
| 182 } |
| 183 |
92 // Confirms that the javascript variable indicating whether or not we have | 184 // Confirms that the javascript variable indicating whether or not we have |
93 // a stale copy in the cache has been set to |expected|. | 185 // a stale copy in the cache has been set to |expected|. |
94 bool ProbeStaleCopyValue(bool expected) { | 186 bool ProbeStaleCopyValue(bool expected) { |
95 const char* js_cache_probe = | 187 const char* js_cache_probe = |
96 "(function () {\n" | 188 "(function () {\n" |
97 " if ('staleCopyInCache' in templateData) {\n" | 189 " if ('staleCopyInCache' in templateData) {\n" |
98 " domAutomationController.send(\n" | 190 " domAutomationController.send(\n" |
99 " templateData.staleCopyInCache ? 'yes' : 'no');\n" | 191 " templateData.staleCopyInCache ? 'yes' : 'no');\n" |
100 " } else {\n" | 192 " } else {\n" |
101 " domAutomationController.send('absent');\n" | 193 " domAutomationController.send('absent');\n" |
102 " }\n" | 194 " }\n" |
103 "})();"; | 195 "})();"; |
104 | 196 |
105 std::string result; | 197 std::string result; |
106 bool ret = | 198 bool ret = |
107 content::ExecuteScriptAndExtractString( | 199 content::ExecuteScriptAndExtractString( |
108 browser()->tab_strip_model()->GetActiveWebContents(), | 200 browser()->tab_strip_model()->GetActiveWebContents(), |
109 js_cache_probe, | 201 js_cache_probe, |
110 &result); | 202 &result); |
111 EXPECT_TRUE(ret); | 203 EXPECT_TRUE(ret); |
112 if (!ret) | 204 if (!ret) |
113 return false; | 205 return false; |
114 EXPECT_EQ(expected ? "yes" : "no", result); | 206 EXPECT_EQ(expected ? "yes" : "no", result); |
115 return ((expected ? "yes" : "no") == result); | 207 return ((expected ? "yes" : "no") == result); |
116 } | 208 } |
117 | 209 |
118 protected: | 210 protected: |
| 211 static void EnableMocks(const GURL& search_url) { |
| 212 chrome_browser_net::SetUrlRequestMocksEnabled(true); |
| 213 |
| 214 // Add a mock for the search engine the error page will use. |
| 215 base::FilePath root_http; |
| 216 PathService::Get(chrome::DIR_TEST_DATA, &root_http); |
| 217 content::URLRequestMockHTTPJob::AddHostnameToFileHandler( |
| 218 search_url.host(), root_http.AppendASCII("title3.html")); |
| 219 } |
| 220 |
119 virtual void SetUpOnMainThread() OVERRIDE { | 221 virtual void SetUpOnMainThread() OVERRIDE { |
120 BrowserThread::PostTask( | 222 BrowserThread::PostTask( |
121 BrowserThread::IO, FROM_HERE, | 223 BrowserThread::IO, FROM_HERE, |
122 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); | 224 base::Bind(&ErrorPageTest::EnableMocks, |
| 225 google_util::GetGoogleSearchURL(browser()->profile()))); |
123 } | 226 } |
124 | 227 |
125 // Returns a GURL that results in a DNS error. | 228 // Returns a GURL that results in a DNS error. |
126 GURL GetDnsErrorURL() const { | 229 GURL GetDnsErrorURL() const { |
127 return URLRequestFailedJob::GetMockHttpUrl(net::ERR_NAME_NOT_RESOLVED); | 230 return URLRequestFailedJob::GetMockHttpUrl(net::ERR_NAME_NOT_RESOLVED); |
128 } | 231 } |
129 | 232 |
130 private: | 233 private: |
131 // Navigates the browser the indicated direction in the history and waits for | 234 // Navigates the browser the indicated direction in the history and waits for |
132 // |num_navigations| to occur and the title to change to |expected_title|. | 235 // |num_navigations| to occur and the title to change to |expected_title|. |
133 void NavigateHistoryAndWaitForTitle(const std::string& expected_title, | 236 void NavigateHistoryAndWaitForTitle(const std::string& expected_title, |
134 int num_navigations, | 237 int num_navigations, |
135 HistoryNavigationDirection direction) { | 238 HistoryNavigationDirection direction) { |
136 content::TitleWatcher title_watcher( | 239 content::TitleWatcher title_watcher( |
137 browser()->tab_strip_model()->GetActiveWebContents(), | 240 browser()->tab_strip_model()->GetActiveWebContents(), |
138 base::ASCIIToUTF16(expected_title)); | 241 base::ASCIIToUTF16(expected_title)); |
139 | 242 |
| 243 NavigateHistory(num_navigations, direction); |
| 244 |
| 245 EXPECT_EQ(title_watcher.WaitAndGetTitle(), |
| 246 base::ASCIIToUTF16(expected_title)); |
| 247 } |
| 248 |
| 249 void NavigateHistory(int num_navigations, |
| 250 HistoryNavigationDirection direction) { |
140 content::TestNavigationObserver test_navigation_observer( | 251 content::TestNavigationObserver test_navigation_observer( |
141 browser()->tab_strip_model()->GetActiveWebContents(), | 252 browser()->tab_strip_model()->GetActiveWebContents(), |
142 num_navigations); | 253 num_navigations); |
143 if (direction == HISTORY_NAVIGATE_BACK) { | 254 if (direction == HISTORY_NAVIGATE_BACK) { |
144 chrome::GoBack(browser(), CURRENT_TAB); | 255 chrome::GoBack(browser(), CURRENT_TAB); |
145 } else if (direction == HISTORY_NAVIGATE_FORWARD) { | 256 } else if (direction == HISTORY_NAVIGATE_FORWARD) { |
146 chrome::GoForward(browser(), CURRENT_TAB); | 257 chrome::GoForward(browser(), CURRENT_TAB); |
147 } else { | 258 } else { |
148 FAIL(); | 259 FAIL(); |
149 } | 260 } |
150 test_navigation_observer.Wait(); | 261 test_navigation_observer.Wait(); |
151 | |
152 EXPECT_EQ(title_watcher.WaitAndGetTitle(), | |
153 base::ASCIIToUTF16(expected_title)); | |
154 } | 262 } |
155 }; | 263 }; |
156 | 264 |
157 class TestFailProvisionalLoadObserver : public content::WebContentsObserver { | 265 class TestFailProvisionalLoadObserver : public content::WebContentsObserver { |
158 public: | 266 public: |
159 explicit TestFailProvisionalLoadObserver(content::WebContents* contents) | 267 explicit TestFailProvisionalLoadObserver(content::WebContents* contents) |
160 : content::WebContentsObserver(contents) {} | 268 : content::WebContentsObserver(contents) {} |
161 virtual ~TestFailProvisionalLoadObserver() {} | 269 virtual ~TestFailProvisionalLoadObserver() {} |
162 | 270 |
163 // This method is invoked when the provisional load failed. | 271 // This method is invoked when the provisional load failed. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 // See crbug.com/109669 | 304 // See crbug.com/109669 |
197 #if defined(USE_AURA) || defined(OS_WIN) | 305 #if defined(USE_AURA) || defined(OS_WIN) |
198 #define MAYBE_DNSError_Basic DISABLED_DNSError_Basic | 306 #define MAYBE_DNSError_Basic DISABLED_DNSError_Basic |
199 #else | 307 #else |
200 #define MAYBE_DNSError_Basic DNSError_Basic | 308 #define MAYBE_DNSError_Basic DNSError_Basic |
201 #endif | 309 #endif |
202 // Test that a DNS error occuring in the main frame redirects to an error page. | 310 // Test that a DNS error occuring in the main frame redirects to an error page. |
203 IN_PROC_BROWSER_TEST_F(ErrorPageTest, MAYBE_DNSError_Basic) { | 311 IN_PROC_BROWSER_TEST_F(ErrorPageTest, MAYBE_DNSError_Basic) { |
204 // The first navigation should fail, and the second one should be the error | 312 // The first navigation should fail, and the second one should be the error |
205 // page. | 313 // page. |
206 NavigateToURLAndWaitForTitle(GetDnsErrorURL(), "Mock Link Doctor", 2); | 314 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
| 315 browser(), GetDnsErrorURL(), 2); |
| 316 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); |
207 } | 317 } |
208 | 318 |
209 // See crbug.com/109669 | 319 // See crbug.com/109669 |
210 #if defined(USE_AURA) | 320 #if defined(USE_AURA) |
211 #define MAYBE_DNSError_GoBack1 DISABLED_DNSError_GoBack1 | 321 #define MAYBE_DNSError_GoBack1 DISABLED_DNSError_GoBack1 |
212 #else | 322 #else |
213 #define MAYBE_DNSError_GoBack1 DNSError_GoBack1 | 323 #define MAYBE_DNSError_GoBack1 DNSError_GoBack1 |
214 #endif | 324 #endif |
215 | 325 |
216 // Test that a DNS error occuring in the main frame does not result in an | 326 // Test that a DNS error occuring in the main frame does not result in an |
217 // additional session history entry. | 327 // additional session history entry. |
218 IN_PROC_BROWSER_TEST_F(ErrorPageTest, MAYBE_DNSError_GoBack1) { | 328 IN_PROC_BROWSER_TEST_F(ErrorPageTest, MAYBE_DNSError_GoBack1) { |
219 NavigateToFileURL(FILE_PATH_LITERAL("title2.html")); | 329 NavigateToFileURL(FILE_PATH_LITERAL("title2.html")); |
220 NavigateToURLAndWaitForTitle(GetDnsErrorURL(), "Mock Link Doctor", 2); | 330 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
| 331 browser(), GetDnsErrorURL(), 2); |
| 332 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); |
221 GoBackAndWaitForTitle("Title Of Awesomeness", 1); | 333 GoBackAndWaitForTitle("Title Of Awesomeness", 1); |
222 } | 334 } |
223 | 335 |
224 // See crbug.com/109669 | 336 // See crbug.com/109669 |
225 #if defined(USE_AURA) | 337 #if defined(USE_AURA) |
226 #define MAYBE_DNSError_GoBack2 DISABLED_DNSError_GoBack2 | 338 #define MAYBE_DNSError_GoBack2 DISABLED_DNSError_GoBack2 |
227 #else | 339 #else |
228 #define MAYBE_DNSError_GoBack2 DNSError_GoBack2 | 340 #define MAYBE_DNSError_GoBack2 DNSError_GoBack2 |
229 #endif | 341 #endif |
230 // Test that a DNS error occuring in the main frame does not result in an | 342 // Test that a DNS error occuring in the main frame does not result in an |
231 // additional session history entry. | 343 // additional session history entry. |
232 IN_PROC_BROWSER_TEST_F(ErrorPageTest, DNSError_GoBack2) { | 344 IN_PROC_BROWSER_TEST_F(ErrorPageTest, DNSError_GoBack2) { |
233 NavigateToFileURL(FILE_PATH_LITERAL("title2.html")); | 345 NavigateToFileURL(FILE_PATH_LITERAL("title2.html")); |
234 | 346 |
235 NavigateToURLAndWaitForTitle(GetDnsErrorURL(), "Mock Link Doctor", 2); | 347 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
| 348 browser(), GetDnsErrorURL(), 2); |
| 349 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); |
| 350 |
236 NavigateToFileURL(FILE_PATH_LITERAL("title3.html")); | 351 NavigateToFileURL(FILE_PATH_LITERAL("title3.html")); |
237 | 352 |
238 GoBackAndWaitForTitle("Mock Link Doctor", 2); | 353 GoBackAndWaitForNavigations(2); |
| 354 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); |
| 355 |
239 GoBackAndWaitForTitle("Title Of Awesomeness", 1); | 356 GoBackAndWaitForTitle("Title Of Awesomeness", 1); |
240 } | 357 } |
241 | 358 |
242 // See crbug.com/109669 | 359 // See crbug.com/109669 |
243 #if defined(USE_AURA) | 360 #if defined(USE_AURA) |
244 #define MAYBE_DNSError_GoBack2AndForward DISABLED_DNSError_GoBack2AndForward | 361 #define MAYBE_DNSError_GoBack2AndForward DISABLED_DNSError_GoBack2AndForward |
245 #else | 362 #else |
246 #define MAYBE_DNSError_GoBack2AndForward DNSError_GoBack2AndForward | 363 #define MAYBE_DNSError_GoBack2AndForward DNSError_GoBack2AndForward |
247 #endif | 364 #endif |
248 // Test that a DNS error occuring in the main frame does not result in an | 365 // Test that a DNS error occuring in the main frame does not result in an |
249 // additional session history entry. | 366 // additional session history entry. |
250 IN_PROC_BROWSER_TEST_F(ErrorPageTest, DNSError_GoBack2AndForward) { | 367 IN_PROC_BROWSER_TEST_F(ErrorPageTest, DNSError_GoBack2AndForward) { |
251 NavigateToFileURL(FILE_PATH_LITERAL("title2.html")); | 368 NavigateToFileURL(FILE_PATH_LITERAL("title2.html")); |
252 | 369 |
253 NavigateToURLAndWaitForTitle(GetDnsErrorURL(), "Mock Link Doctor", 2); | 370 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
| 371 browser(), GetDnsErrorURL(), 2); |
| 372 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); |
| 373 |
254 NavigateToFileURL(FILE_PATH_LITERAL("title3.html")); | 374 NavigateToFileURL(FILE_PATH_LITERAL("title3.html")); |
255 | 375 |
256 GoBackAndWaitForTitle("Mock Link Doctor", 2); | 376 GoBackAndWaitForNavigations(2); |
| 377 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); |
| 378 |
257 GoBackAndWaitForTitle("Title Of Awesomeness", 1); | 379 GoBackAndWaitForTitle("Title Of Awesomeness", 1); |
258 | 380 |
259 GoForwardAndWaitForTitle("Mock Link Doctor", 2); | 381 GoForwardAndWaitForNavigations(2); |
| 382 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); |
260 } | 383 } |
261 | 384 |
262 // See crbug.com/109669 | 385 // See crbug.com/109669 |
263 #if defined(USE_AURA) | 386 #if defined(USE_AURA) |
264 #define MAYBE_DNSError_GoBack2Forward2 DISABLED_DNSError_GoBack2Forward2 | 387 #define MAYBE_DNSError_GoBack2Forward2 DISABLED_DNSError_GoBack2Forward2 |
265 #else | 388 #else |
266 #define MAYBE_DNSError_GoBack2Forward2 DNSError_GoBack2Forward2 | 389 #define MAYBE_DNSError_GoBack2Forward2 DNSError_GoBack2Forward2 |
267 #endif | 390 #endif |
268 // Test that a DNS error occuring in the main frame does not result in an | 391 // Test that a DNS error occuring in the main frame does not result in an |
269 // additional session history entry. | 392 // additional session history entry. |
270 IN_PROC_BROWSER_TEST_F(ErrorPageTest, DNSError_GoBack2Forward2) { | 393 IN_PROC_BROWSER_TEST_F(ErrorPageTest, DNSError_GoBack2Forward2) { |
271 NavigateToFileURL(FILE_PATH_LITERAL("title3.html")); | 394 NavigateToFileURL(FILE_PATH_LITERAL("title3.html")); |
272 | 395 |
273 NavigateToURLAndWaitForTitle(GetDnsErrorURL(), "Mock Link Doctor", 2); | 396 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
| 397 browser(), GetDnsErrorURL(), 2); |
| 398 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); |
| 399 |
274 NavigateToFileURL(FILE_PATH_LITERAL("title2.html")); | 400 NavigateToFileURL(FILE_PATH_LITERAL("title2.html")); |
275 | 401 |
276 GoBackAndWaitForTitle("Mock Link Doctor", 2); | 402 GoBackAndWaitForNavigations(2); |
| 403 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); |
| 404 |
277 GoBackAndWaitForTitle("Title Of More Awesomeness", 1); | 405 GoBackAndWaitForTitle("Title Of More Awesomeness", 1); |
278 | 406 |
279 GoForwardAndWaitForTitle("Mock Link Doctor", 2); | 407 GoForwardAndWaitForNavigations(2); |
| 408 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); |
| 409 |
280 GoForwardAndWaitForTitle("Title Of Awesomeness", 1); | 410 GoForwardAndWaitForTitle("Title Of Awesomeness", 1); |
281 } | 411 } |
282 | 412 |
283 // Test that a DNS error occuring in an iframe. | 413 // See crbug.com/109669 |
| 414 #if defined(USE_AURA) |
| 415 #define MAYBE_DNSError_DoSearch DNSError_DoSearch |
| 416 #else |
| 417 #define MAYBE_DNSError_DoSearch DNSError_DoSearch |
| 418 #endif |
| 419 // Test that the search button on a DNS error page works. |
| 420 IN_PROC_BROWSER_TEST_F(ErrorPageTest, MAYBE_DNSError_DoSearch) { |
| 421 // The first navigation should fail, and the second one should be the error |
| 422 // page. |
| 423 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
| 424 browser(), GetDnsErrorURL(), 2); |
| 425 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); |
| 426 |
| 427 // Do a search and make sure the browser ends up at the right page. |
| 428 content::TestNavigationObserver nav_observer( |
| 429 browser()->tab_strip_model()->GetActiveWebContents(), |
| 430 1); |
| 431 content::TitleWatcher title_watcher( |
| 432 browser()->tab_strip_model()->GetActiveWebContents(), |
| 433 base::ASCIIToUTF16("Title Of More Awesomeness")); |
| 434 ASSERT_TRUE(content::ExecuteScript( |
| 435 browser()->tab_strip_model()->GetActiveWebContents(), |
| 436 "document.getElementById('search-button').click();")); |
| 437 nav_observer.Wait(); |
| 438 EXPECT_EQ(base::ASCIIToUTF16("Title Of More Awesomeness"), |
| 439 title_watcher.WaitAndGetTitle()); |
| 440 |
| 441 // Check the path and query string. |
| 442 std::string url; |
| 443 ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
| 444 browser()->tab_strip_model()->GetActiveWebContents(), |
| 445 "domAutomationController.send(window.location.href);", |
| 446 &url)); |
| 447 EXPECT_EQ("/search", GURL(url).path()); |
| 448 EXPECT_EQ("q=search%20query", GURL(url).query()); |
| 449 |
| 450 // Go back to the error page, to make sure the history is correct. |
| 451 GoBackAndWaitForNavigations(2); |
| 452 ExpectDisplayingNavigationCorrections(browser(), net::ERR_NAME_NOT_RESOLVED); |
| 453 } |
| 454 |
| 455 // Test that a DNS error occuring in an iframe does not result in showing |
| 456 // navigation corrections. |
284 IN_PROC_BROWSER_TEST_F(ErrorPageTest, IFrameDNSError_Basic) { | 457 IN_PROC_BROWSER_TEST_F(ErrorPageTest, IFrameDNSError_Basic) { |
285 NavigateToURLAndWaitForTitle( | 458 NavigateToURLAndWaitForTitle( |
286 content::URLRequestMockHTTPJob::GetMockUrl( | 459 content::URLRequestMockHTTPJob::GetMockUrl( |
287 base::FilePath(FILE_PATH_LITERAL("iframe_dns_error.html"))), | 460 base::FilePath(FILE_PATH_LITERAL("iframe_dns_error.html"))), |
288 "Blah", | 461 "Blah", |
289 1); | 462 1); |
290 // We expect to have two history entries, since we started off with navigation | 463 // We expect to have two history entries, since we started off with navigation |
291 // to "about:blank" and then navigated to "iframe_dns_error.html". | 464 // to "about:blank" and then navigated to "iframe_dns_error.html". |
292 EXPECT_EQ(2, | 465 EXPECT_EQ(2, |
293 browser()->tab_strip_model()->GetActiveWebContents()-> | 466 browser()->tab_strip_model()->GetActiveWebContents()-> |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 content::Source<NavigationController>(&wc->GetController())); | 558 content::Source<NavigationController>(&wc->GetController())); |
386 wc->GetRenderViewHost()->ExecuteJavascriptInWebFrame( | 559 wc->GetRenderViewHost()->ExecuteJavascriptInWebFrame( |
387 base::string16(), base::ASCIIToUTF16(script)); | 560 base::string16(), base::ASCIIToUTF16(script)); |
388 load_observer.Wait(); | 561 load_observer.Wait(); |
389 | 562 |
390 EXPECT_EQ(fail_url, fail_observer.fail_url()); | 563 EXPECT_EQ(fail_url, fail_observer.fail_url()); |
391 EXPECT_EQ(2, wc->GetController().GetEntryCount()); | 564 EXPECT_EQ(2, wc->GetController().GetEntryCount()); |
392 } | 565 } |
393 } | 566 } |
394 | 567 |
395 // Checks that the Link Doctor is not loaded when we receive an actual 404 page. | 568 // Checks that navigation corrections are not loaded when we receive an actual |
| 569 // 404 page. |
396 IN_PROC_BROWSER_TEST_F(ErrorPageTest, Page404) { | 570 IN_PROC_BROWSER_TEST_F(ErrorPageTest, Page404) { |
397 NavigateToURLAndWaitForTitle( | 571 NavigateToURLAndWaitForTitle( |
398 content::URLRequestMockHTTPJob::GetMockUrl( | 572 content::URLRequestMockHTTPJob::GetMockUrl( |
399 base::FilePath(FILE_PATH_LITERAL("page404.html"))), | 573 base::FilePath(FILE_PATH_LITERAL("page404.html"))), |
400 "SUCCESS", | 574 "SUCCESS", |
401 1); | 575 1); |
402 } | 576 } |
403 | 577 |
404 // Checks that when an error occurs, the stale cache status of the page | 578 // Checks that when an error occurs, the stale cache status of the page |
405 // is correctly transferred. | 579 // is correctly transferred. |
406 IN_PROC_BROWSER_TEST_F(ErrorPageTest, StaleCacheStatus) { | 580 IN_PROC_BROWSER_TEST_F(ErrorPageTest, StaleCacheStatus) { |
407 ASSERT_TRUE(test_server()->Start()); | 581 ASSERT_TRUE(test_server()->Start()); |
408 // Load cache with entry with "nocache" set, to create stale | 582 // Load cache with entry with "nocache" set, to create stale |
409 // cache. | 583 // cache. |
410 GURL test_url(test_server()->GetURL("files/nocache.html")); | 584 GURL test_url(test_server()->GetURL("files/nocache.html")); |
411 NavigateToURLAndWaitForTitle(test_url, "Nocache Test Page", 1); | 585 NavigateToURLAndWaitForTitle(test_url, "Nocache Test Page", 1); |
412 | 586 |
413 // Reload same URL after forcing an error from the the network layer; | 587 // Reload same URL after forcing an error from the the network layer; |
414 // confirm that the error page is told the cached copy exists. | 588 // confirm that the error page is told the cached copy exists. |
415 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter = | 589 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter = |
416 browser()->profile()->GetRequestContext(); | 590 browser()->profile()->GetRequestContext(); |
417 BrowserThread::PostTask( | 591 BrowserThread::PostTask( |
418 BrowserThread::IO, FROM_HERE, | 592 BrowserThread::IO, FROM_HERE, |
419 base::Bind(&InterceptNetworkTransactions, url_request_context_getter, | 593 base::Bind(&InterceptNetworkTransactions, url_request_context_getter, |
420 // Note that we can't use an error that'll invoke the link | |
421 // doctor. In normal network error conditions that would | |
422 // work (because the link doctor fetch would also fail, | |
423 // putting us back in the main offline path), but | |
424 // SetUrlRequestMocksEnabled() has also specfied a link | |
425 // doctor mock, which will be accessible because it | |
426 // won't go through the network cache. | |
427 net::ERR_FAILED)); | 594 net::ERR_FAILED)); |
428 | 595 |
429 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( | 596 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
430 // With no link doctor load, there's only one navigation. | 597 // With no navigation corrections to load, there's only one navigation. |
431 browser(), test_url, 1); | 598 browser(), test_url, 1); |
432 EXPECT_TRUE(ProbeStaleCopyValue(true)); | 599 EXPECT_TRUE(ProbeStaleCopyValue(true)); |
433 | 600 |
434 // Clear the cache and reload the same URL; confirm the error page is told | 601 // Clear the cache and reload the same URL; confirm the error page is told |
435 // that there is no cached copy. | 602 // that there is no cached copy. |
436 BrowsingDataRemover* remover = | 603 BrowsingDataRemover* remover = |
437 BrowsingDataRemover::CreateForUnboundedRange(browser()->profile()); | 604 BrowsingDataRemover::CreateForUnboundedRange(browser()->profile()); |
438 remover->Remove(BrowsingDataRemover::REMOVE_CACHE, | 605 remover->Remove(BrowsingDataRemover::REMOVE_CACHE, |
439 BrowsingDataHelper::UNPROTECTED_WEB); | 606 BrowsingDataHelper::UNPROTECTED_WEB); |
440 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( | 607 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
441 browser(), test_url, 1); | 608 browser(), test_url, 1); |
442 EXPECT_TRUE(ProbeStaleCopyValue(false)); | 609 EXPECT_TRUE(ProbeStaleCopyValue(false)); |
443 } | 610 } |
444 | 611 |
445 // Returns Javascript code that executes plain text search for the page. | |
446 // Pass into content::ExecuteScriptAndExtractBool as |script| parameter. | |
447 std::string GetTextContentContainsStringScript( | |
448 const std::string& value_to_search) { | |
449 return base::StringPrintf( | |
450 "var textContent = document.body.textContent;" | |
451 "var hasError = textContent.indexOf('%s') >= 0;" | |
452 "domAutomationController.send(hasError);", | |
453 value_to_search.c_str()); | |
454 } | |
455 | |
456 // Protocol handler that fails all requests with net::ERR_ADDRESS_UNREACHABLE. | 612 // Protocol handler that fails all requests with net::ERR_ADDRESS_UNREACHABLE. |
457 class AddressUnreachableProtocolHandler | 613 class AddressUnreachableProtocolHandler |
458 : public net::URLRequestJobFactory::ProtocolHandler { | 614 : public net::URLRequestJobFactory::ProtocolHandler { |
459 public: | 615 public: |
460 AddressUnreachableProtocolHandler() {} | 616 AddressUnreachableProtocolHandler() {} |
461 virtual ~AddressUnreachableProtocolHandler() {} | 617 virtual ~AddressUnreachableProtocolHandler() {} |
462 | 618 |
463 // net::URLRequestJobFactory::ProtocolHandler: | 619 // net::URLRequestJobFactory::ProtocolHandler: |
464 virtual net::URLRequestJob* MaybeCreateJob( | 620 virtual net::URLRequestJob* MaybeCreateJob( |
465 net::URLRequest* request, | 621 net::URLRequest* request, |
466 net::NetworkDelegate* network_delegate) const OVERRIDE { | 622 net::NetworkDelegate* network_delegate) const OVERRIDE { |
467 return new URLRequestFailedJob(request, | 623 return new URLRequestFailedJob(request, |
468 network_delegate, | 624 network_delegate, |
469 net::ERR_ADDRESS_UNREACHABLE); | 625 net::ERR_ADDRESS_UNREACHABLE); |
470 } | 626 } |
471 | 627 |
472 private: | 628 private: |
473 DISALLOW_COPY_AND_ASSIGN(AddressUnreachableProtocolHandler); | 629 DISALLOW_COPY_AND_ASSIGN(AddressUnreachableProtocolHandler); |
474 }; | 630 }; |
475 | 631 |
476 // A test fixture that returns ERR_ADDRESS_UNREACHABLE for all Link Doctor | 632 // A test fixture that returns ERR_ADDRESS_UNREACHABLE for all navigation |
477 // requests. ERR_NAME_NOT_RESOLVED is more typical, but need to use a different | 633 // correction requests. ERR_NAME_NOT_RESOLVED is more typical, but need to use |
478 // error for the Link Doctor and the original page to validate the right page | 634 // a different error for the correction service and the original page to |
479 // is being displayed. | 635 // validate the right page is being displayed. |
480 class ErrorPageLinkDoctorFailTest : public ErrorPageTest { | 636 class ErrorPageNavigationCorrectionsFailTest : public ErrorPageTest { |
481 public: | 637 public: |
482 // InProcessBrowserTest: | 638 // InProcessBrowserTest: |
483 virtual void SetUpOnMainThread() OVERRIDE { | 639 virtual void SetUpOnMainThread() OVERRIDE { |
484 BrowserThread::PostTask( | 640 BrowserThread::PostTask( |
485 BrowserThread::IO, FROM_HERE, | 641 BrowserThread::IO, FROM_HERE, |
486 base::Bind(&ErrorPageLinkDoctorFailTest::AddFilters)); | 642 base::Bind(&ErrorPageNavigationCorrectionsFailTest::AddFilters)); |
487 } | 643 } |
488 | 644 |
489 virtual void CleanUpOnMainThread() OVERRIDE { | 645 virtual void CleanUpOnMainThread() OVERRIDE { |
490 BrowserThread::PostTask( | 646 BrowserThread::PostTask( |
491 BrowserThread::IO, FROM_HERE, | 647 BrowserThread::IO, FROM_HERE, |
492 base::Bind(&ErrorPageLinkDoctorFailTest::RemoveFilters)); | 648 base::Bind(&ErrorPageNavigationCorrectionsFailTest::RemoveFilters)); |
493 } | 649 } |
494 | 650 |
495 private: | 651 private: |
496 // Adds a filter that causes all requests for the Link Doctor's scheme and | 652 // Adds a filter that causes all correction service requests to fail with |
497 // host to fail with ERR_ADDRESS_UNREACHABLE. Since the Link Doctor adds | 653 // ERR_ADDRESS_UNREACHABLE. |
498 // query strings, it's not enough to just fail exact matches. | |
499 // | 654 // |
500 // Also adds the content::URLRequestFailedJob filter. | 655 // Also adds the content::URLRequestFailedJob filter. |
501 static void AddFilters() { | 656 static void AddFilters() { |
502 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 657 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
503 content::URLRequestFailedJob::AddUrlHandler(); | 658 content::URLRequestFailedJob::AddUrlHandler(); |
504 | 659 |
505 net::URLRequestFilter::GetInstance()->AddHostnameProtocolHandler( | 660 net::URLRequestFilter::GetInstance()->AddUrlProtocolHandler( |
506 google_util::LinkDoctorBaseURL().scheme(), | 661 google_util::LinkDoctorBaseURL(), |
507 google_util::LinkDoctorBaseURL().host(), | |
508 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>( | 662 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>( |
509 new AddressUnreachableProtocolHandler())); | 663 new AddressUnreachableProtocolHandler())); |
510 } | 664 } |
511 | 665 |
512 static void RemoveFilters() { | 666 static void RemoveFilters() { |
513 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 667 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
514 net::URLRequestFilter::GetInstance()->ClearHandlers(); | 668 net::URLRequestFilter::GetInstance()->ClearHandlers(); |
515 } | 669 } |
516 }; | 670 }; |
517 | 671 |
518 // Make sure that when the Link Doctor fails to load, the network error page is | 672 // Make sure that when corrections fail to load, the network error page is |
519 // successfully loaded. | 673 // successfully loaded. |
520 IN_PROC_BROWSER_TEST_F(ErrorPageLinkDoctorFailTest, LinkDoctorFail) { | 674 IN_PROC_BROWSER_TEST_F(ErrorPageNavigationCorrectionsFailTest, |
| 675 FetchCorrectionsFails) { |
521 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( | 676 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
522 browser(), | 677 browser(), |
523 URLRequestFailedJob::GetMockHttpUrl(net::ERR_NAME_NOT_RESOLVED), | 678 URLRequestFailedJob::GetMockHttpUrl(net::ERR_NAME_NOT_RESOLVED), |
524 2); | 679 2); |
525 | 680 |
526 // Verify that the expected error page is being displayed. Do this by making | 681 // Verify that the expected error page is being displayed. |
527 // sure the original error code (ERR_NAME_NOT_RESOLVED) is displayed. | 682 ExpectDisplayingLocalErrorPage(browser(), net::ERR_NAME_NOT_RESOLVED); |
528 bool result = false; | |
529 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | |
530 browser()->tab_strip_model()->GetActiveWebContents(), | |
531 GetTextContentContainsStringScript("ERR_NAME_NOT_RESOLVED"), | |
532 &result)); | |
533 EXPECT_TRUE(result); | |
534 } | 683 } |
535 | 684 |
536 // Checks that when an error occurs and a link doctor load fails, the stale | 685 // Checks that when an error occurs and a corrections fail to load, the stale |
537 // cache status of the page is correctly transferred. Most logic copied | 686 // cache status of the page is correctly transferred. Most logic copied |
538 // from StaleCacheStatus above. | 687 // from StaleCacheStatus above. |
539 IN_PROC_BROWSER_TEST_F(ErrorPageLinkDoctorFailTest, | 688 IN_PROC_BROWSER_TEST_F(ErrorPageNavigationCorrectionsFailTest, |
540 StaleCacheStatusFailedLinkDoctor) { | 689 StaleCacheStatusFailedCorrections) { |
541 ASSERT_TRUE(test_server()->Start()); | 690 ASSERT_TRUE(test_server()->Start()); |
542 // Load cache with entry with "nocache" set, to create stale | 691 // Load cache with entry with "nocache" set, to create stale |
543 // cache. | 692 // cache. |
544 GURL test_url(test_server()->GetURL("files/nocache.html")); | 693 GURL test_url(test_server()->GetURL("files/nocache.html")); |
545 NavigateToURLAndWaitForTitle(test_url, "Nocache Test Page", 1); | 694 NavigateToURLAndWaitForTitle(test_url, "Nocache Test Page", 1); |
546 | 695 |
547 // Reload same URL after forcing an error from the the network layer; | 696 // Reload same URL after forcing an error from the the network layer; |
548 // confirm that the error page is told the cached copy exists. | 697 // confirm that the error page is told the cached copy exists. |
549 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter = | 698 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter = |
550 browser()->profile()->GetRequestContext(); | 699 browser()->profile()->GetRequestContext(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 }; | 753 }; |
605 | 754 |
606 const char ErrorPageForIDNTest::kHostname[] = | 755 const char ErrorPageForIDNTest::kHostname[] = |
607 "xn--d1abbgf6aiiy.xn--p1ai"; | 756 "xn--d1abbgf6aiiy.xn--p1ai"; |
608 const char ErrorPageForIDNTest::kHostnameJSUnicode[] = | 757 const char ErrorPageForIDNTest::kHostnameJSUnicode[] = |
609 "\\u043f\\u0440\\u0435\\u0437\\u0438\\u0434\\u0435\\u043d\\u0442." | 758 "\\u043f\\u0440\\u0435\\u0437\\u0438\\u0434\\u0435\\u043d\\u0442." |
610 "\\u0440\\u0444"; | 759 "\\u0440\\u0444"; |
611 | 760 |
612 // Make sure error page shows correct unicode for IDN. | 761 // Make sure error page shows correct unicode for IDN. |
613 IN_PROC_BROWSER_TEST_F(ErrorPageForIDNTest, IDN) { | 762 IN_PROC_BROWSER_TEST_F(ErrorPageForIDNTest, IDN) { |
614 // ERR_UNSAFE_PORT will not trigger the link doctor. | 763 // ERR_UNSAFE_PORT will not trigger navigation corrections. |
615 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( | 764 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
616 browser(), | 765 browser(), |
617 URLRequestFailedJob::GetMockHttpUrlForHostname(net::ERR_UNSAFE_PORT, | 766 URLRequestFailedJob::GetMockHttpUrlForHostname(net::ERR_UNSAFE_PORT, |
618 kHostname), | 767 kHostname), |
619 1); | 768 1); |
620 | 769 |
621 bool result = false; | 770 ToggleHelpBox(browser()); |
622 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 771 EXPECT_TRUE(IsDisplayingText(browser(), kHostnameJSUnicode)); |
623 browser()->tab_strip_model()->GetActiveWebContents(), | |
624 GetTextContentContainsStringScript(kHostnameJSUnicode), | |
625 &result)); | |
626 EXPECT_TRUE(result); | |
627 } | 772 } |
628 | 773 |
629 } // namespace | 774 } // namespace |
OLD | NEW |