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/tabs/tab_strip_model.h" | 8 #include "chrome/browser/ui/tabs/tab_strip_model.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/browser_test_utils.h" | |
18 #include "content/public/test/test_navigation_observer.h" | 17 #include "content/public/test/test_navigation_observer.h" |
19 #include "url/gurl.h" | 18 #include "url/gurl.h" |
20 | 19 |
21 using content::OpenURLParams; | 20 using content::OpenURLParams; |
22 using content::Referrer; | 21 using content::Referrer; |
23 | 22 |
24 class NewTabUIBrowserTest : public InProcessBrowserTest { | 23 class NewTabUIBrowserTest : public InProcessBrowserTest { |
25 public: | 24 public: |
26 NewTabUIBrowserTest() {} | 25 NewTabUIBrowserTest() {} |
27 }; | 26 }; |
28 | 27 |
29 // Ensure that chrome-internal: still loads the NTP. | |
30 // See http://crbug.com/6564. | |
31 IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, ChromeInternalLoadsNTP) { | |
32 // Go to the "new tab page" using its old url, rather than chrome://newtab. | |
33 // Ensure that we get there by checking for non-empty page content. | |
34 ui_test_utils::NavigateToURL(browser(), GURL("chrome-internal:")); | |
35 bool empty_inner_html = false; | |
36 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | |
37 browser()->tab_strip_model()->GetWebContentsAt(0), | |
38 "window.domAutomationController.send(document.body.innerHTML == '')", | |
39 &empty_inner_html)); | |
40 ASSERT_FALSE(empty_inner_html); | |
41 } | |
42 | |
43 // TODO(samarth): delete along with rest of NTP4 code. | 28 // TODO(samarth): delete along with rest of NTP4 code. |
44 // #if defined(OS_WIN) | 29 // #if defined(OS_WIN) |
45 // // Flaky on Windows (http://crbug.com/174819) | 30 // // Flaky on Windows (http://crbug.com/174819) |
46 // #define MAYBE_LoadNTPInExistingProcess DISABLED_LoadNTPInExistingProcess | 31 // #define MAYBE_LoadNTPInExistingProcess DISABLED_LoadNTPInExistingProcess |
47 // #else | 32 // #else |
48 // #define MAYBE_LoadNTPInExistingProcess LoadNTPInExistingProcess | 33 // #define MAYBE_LoadNTPInExistingProcess LoadNTPInExistingProcess |
49 // #endif | 34 // #endif |
50 | 35 |
51 // Ensure loading a NTP with an existing SiteInstance in a reused process | 36 // Ensure loading a NTP with an existing SiteInstance in a reused process |
52 // doesn't cause us to kill the process. See http://crbug.com/104258. | 37 // doesn't cause us to kill the process. See http://crbug.com/104258. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 144 |
160 // We don't use ui_test_utils::NavigateToURLWithDisposition because that waits | 145 // We don't use ui_test_utils::NavigateToURLWithDisposition because that waits |
161 // for current loading to stop. | 146 // for current loading to stop. |
162 content::TestNavigationObserver observer( | 147 content::TestNavigationObserver observer( |
163 browser()->tab_strip_model()->GetActiveWebContents()); | 148 browser()->tab_strip_model()->GetActiveWebContents()); |
164 browser()->OpenURL(OpenURLParams( | 149 browser()->OpenURL(OpenURLParams( |
165 GURL("data:text/html,hello world"), Referrer(), CURRENT_TAB, | 150 GURL("data:text/html,hello world"), Referrer(), CURRENT_TAB, |
166 content::PAGE_TRANSITION_TYPED, false)); | 151 content::PAGE_TRANSITION_TYPED, false)); |
167 observer.Wait(); | 152 observer.Wait(); |
168 } | 153 } |
OLD | NEW |