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/chrome_notification_types.h" | 6 #include "chrome/browser/chrome_notification_types.h" |
7 #include "chrome/browser/devtools/devtools_window.h" | 7 #include "chrome/browser/devtools/devtools_window.h" |
| 8 #include "chrome/browser/search/search.h" |
8 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
10 #include "chrome/browser/ui/singleton_tabs.h" | 11 #include "chrome/browser/ui/singleton_tabs.h" |
11 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
12 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
13 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
14 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
15 #include "chrome/test/base/test_switches.h" | 16 #include "chrome/test/base/test_switches.h" |
16 #include "chrome/test/base/ui_test_utils.h" | 17 #include "chrome/test/base/ui_test_utils.h" |
17 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 content::RenderProcessHost* rph1 = NULL; | 90 content::RenderProcessHost* rph1 = NULL; |
90 content::RenderProcessHost* rph2 = NULL; | 91 content::RenderProcessHost* rph2 = NULL; |
91 content::RenderProcessHost* rph3 = NULL; | 92 content::RenderProcessHost* rph3 = NULL; |
92 | 93 |
93 // Change the first tab to be the new tab page (TYPE_WEBUI). | 94 // Change the first tab to be the new tab page (TYPE_WEBUI). |
94 GURL newtab(chrome::kChromeUINewTabURL); | 95 GURL newtab(chrome::kChromeUINewTabURL); |
95 ui_test_utils::NavigateToURL(browser(), newtab); | 96 ui_test_utils::NavigateToURL(browser(), newtab); |
96 EXPECT_EQ(tab_count, browser()->tab_strip_model()->count()); | 97 EXPECT_EQ(tab_count, browser()->tab_strip_model()->count()); |
97 tab1 = browser()->tab_strip_model()->GetWebContentsAt(tab_count - 1); | 98 tab1 = browser()->tab_strip_model()->GetWebContentsAt(tab_count - 1); |
98 rph1 = tab1->GetRenderProcessHost(); | 99 rph1 = tab1->GetRenderProcessHost(); |
99 EXPECT_EQ(tab1->GetURL(), newtab); | 100 EXPECT_TRUE(chrome::IsNTPURL(tab1->GetURL(), browser()->profile())); |
100 EXPECT_EQ(host_count, RenderProcessHostCount()); | 101 EXPECT_EQ(host_count, RenderProcessHostCount()); |
101 | 102 |
102 // Create a new TYPE_TABBED tab. It should be in its own process. | 103 // Create a new TYPE_TABBED tab. It should be in its own process. |
103 GURL page1("data:text/html,hello world1"); | 104 GURL page1("data:text/html,hello world1"); |
104 | 105 |
105 ui_test_utils::WindowedTabAddedNotificationObserver observer1( | 106 ui_test_utils::WindowedTabAddedNotificationObserver observer1( |
106 content::NotificationService::AllSources()); | 107 content::NotificationService::AllSources()); |
107 chrome::ShowSingletonTab(browser(), page1); | 108 chrome::ShowSingletonTab(browser(), page1); |
108 observer1.Wait(); | 109 observer1.Wait(); |
109 | 110 |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 chrome::NOTIFICATION_BROWSER_CLOSED, | 424 chrome::NOTIFICATION_BROWSER_CLOSED, |
424 content::NotificationService::AllSources()); | 425 content::NotificationService::AllSources()); |
425 | 426 |
426 // Kill the renderer process, simulating a crash. This should the ProcessDied | 427 // Kill the renderer process, simulating a crash. This should the ProcessDied |
427 // method to be called. Alternatively, RenderProcessHost::OnChannelError can | 428 // method to be called. Alternatively, RenderProcessHost::OnChannelError can |
428 // be called to directly force a call to ProcessDied. | 429 // be called to directly force a call to ProcessDied. |
429 base::KillProcess(wc1->GetRenderProcessHost()->GetHandle(), -1, true); | 430 base::KillProcess(wc1->GetRenderProcessHost()->GetHandle(), -1, true); |
430 | 431 |
431 observer.Wait(); | 432 observer.Wait(); |
432 } | 433 } |
OLD | NEW |