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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
7 #include "chrome/browser/ui/browser_commands.h" | 7 #include "chrome/browser/ui/browser_commands.h" |
8 #include "chrome/browser/ui/browser_tabstrip.h" | 8 #include "chrome/browser/ui/browser_tabstrip.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
11 #include "chrome/test/base/in_process_browser_test.h" | 11 #include "chrome/test/base/in_process_browser_test.h" |
12 #include "chrome/test/base/ui_test_utils.h" | 12 #include "chrome/test/base/ui_test_utils.h" |
13 #include "content/public/browser/notification_service.h" | 13 #include "content/public/browser/notification_service.h" |
14 #include "content/public/browser/notification_types.h" | 14 #include "content/public/browser/notification_types.h" |
15 #include "content/public/browser/render_process_host.h" | 15 #include "content/public/browser/render_process_host.h" |
16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
17 #include "content/public/test/test_navigation_observer.h" | 17 #include "content/public/test/test_navigation_observer.h" |
18 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
19 | 19 |
20 using content::OpenURLParams; | 20 using content::OpenURLParams; |
21 using content::Referrer; | 21 using content::Referrer; |
22 | 22 |
23 class NewTabUIBrowserTest : public InProcessBrowserTest { | 23 class NewTabUIBrowserTest : public InProcessBrowserTest { |
24 public: | 24 public: |
25 NewTabUIBrowserTest() { | 25 NewTabUIBrowserTest() {} |
26 EnableDOMAutomation(); | |
27 } | |
28 }; | 26 }; |
29 | 27 |
30 // Ensure that chrome-internal: still loads the NTP. | 28 // Ensure that chrome-internal: still loads the NTP. |
31 // See http://crbug.com/6564. | 29 // See http://crbug.com/6564. |
32 IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, ChromeInternalLoadsNTP) { | 30 IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, ChromeInternalLoadsNTP) { |
33 // Go to the "new tab page" using its old url, rather than chrome://newtab. | 31 // Go to the "new tab page" using its old url, rather than chrome://newtab. |
34 // Ensure that we get there by checking for non-empty page content. | 32 // Ensure that we get there by checking for non-empty page content. |
35 ui_test_utils::NavigateToURL(browser(), GURL("chrome-internal:")); | 33 ui_test_utils::NavigateToURL(browser(), GURL("chrome-internal:")); |
36 bool empty_inner_html = false; | 34 bool empty_inner_html = false; |
37 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 35 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 144 |
147 // We don't use ui_test_utils::NavigateToURLWithDisposition because that waits | 145 // We don't use ui_test_utils::NavigateToURLWithDisposition because that waits |
148 // for current loading to stop. | 146 // for current loading to stop. |
149 content::TestNavigationObserver observer( | 147 content::TestNavigationObserver observer( |
150 content::NotificationService::AllSources()); | 148 content::NotificationService::AllSources()); |
151 browser()->OpenURL(OpenURLParams( | 149 browser()->OpenURL(OpenURLParams( |
152 GURL("data:text/html,hello world"), Referrer(), CURRENT_TAB, | 150 GURL("data:text/html,hello world"), Referrer(), CURRENT_TAB, |
153 content::PAGE_TRANSITION_TYPED, false)); | 151 content::PAGE_TRANSITION_TYPED, false)); |
154 observer.Wait(); | 152 observer.Wait(); |
155 } | 153 } |
OLD | NEW |