| 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 "chrome/browser/ui/browser_navigator_browsertest.h" | 5 #include "chrome/browser/ui/browser_navigator_browsertest.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 9 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 EXPECT_EQ(1, browser->tab_count()); | 149 EXPECT_EQ(1, browser->tab_count()); |
| 150 EXPECT_EQ(GURL(chrome::kAboutBlankURL), | 150 EXPECT_EQ(GURL(chrome::kAboutBlankURL), |
| 151 chrome::GetActiveWebContents(browser)->GetURL()); | 151 chrome::GetActiveWebContents(browser)->GetURL()); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void BrowserNavigatorTest::Observe( | 154 void BrowserNavigatorTest::Observe( |
| 155 int type, | 155 int type, |
| 156 const content::NotificationSource& source, | 156 const content::NotificationSource& source, |
| 157 const content::NotificationDetails& details) { | 157 const content::NotificationDetails& details) { |
| 158 switch (type) { | 158 switch (type) { |
| 159 case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: { | 159 case content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED: { |
| 160 ++this->created_tab_contents_count_; | 160 ++this->created_tab_contents_count_; |
| 161 break; | 161 break; |
| 162 } | 162 } |
| 163 default: | 163 default: |
| 164 break; | 164 break; |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 | 167 |
| 168 | 168 |
| 169 namespace { | 169 namespace { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 182 // in another or an existing window, or added if it is not. | 182 // in another or an existing window, or added if it is not. |
| 183 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTabExisting) { | 183 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTabExisting) { |
| 184 GURL singleton_url1("http://maps.google.com/"); | 184 GURL singleton_url1("http://maps.google.com/"); |
| 185 | 185 |
| 186 // Register for a notification if an additional tab_contents was instantiated. | 186 // Register for a notification if an additional tab_contents was instantiated. |
| 187 // Opening a Singleton tab that is already opened should not be opening a new | 187 // Opening a Singleton tab that is already opened should not be opening a new |
| 188 // tab nor be creating a new TabContents object. | 188 // tab nor be creating a new TabContents object. |
| 189 content::NotificationRegistrar registrar; | 189 content::NotificationRegistrar registrar; |
| 190 | 190 |
| 191 // As the registrar object goes out of scope, this will get unregistered | 191 // As the registrar object goes out of scope, this will get unregistered |
| 192 registrar.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, | 192 registrar.Add(this, |
| 193 content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED, |
| 193 content::NotificationService::AllSources()); | 194 content::NotificationService::AllSources()); |
| 194 | 195 |
| 195 chrome::AddSelectedTabWithURL(browser(), singleton_url1, | 196 chrome::AddSelectedTabWithURL(browser(), singleton_url1, |
| 196 content::PAGE_TRANSITION_LINK); | 197 content::PAGE_TRANSITION_LINK); |
| 197 chrome::AddSelectedTabWithURL(browser(), GetGoogleURL(), | 198 chrome::AddSelectedTabWithURL(browser(), GetGoogleURL(), |
| 198 content::PAGE_TRANSITION_LINK); | 199 content::PAGE_TRANSITION_LINK); |
| 199 | 200 |
| 200 // We should have one browser with 3 tabs, the 3rd selected. | 201 // We should have one browser with 3 tabs, the 3rd selected. |
| 201 EXPECT_EQ(1u, BrowserList::size()); | 202 EXPECT_EQ(1u, BrowserList::size()); |
| 202 EXPECT_EQ(2, browser()->active_index()); | 203 EXPECT_EQ(2, browser()->active_index()); |
| (...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1278 EXPECT_EQ(browser(), p2.browser); | 1279 EXPECT_EQ(browser(), p2.browser); |
| 1279 | 1280 |
| 1280 // We should now have two windows, the browser() provided by the framework and | 1281 // We should now have two windows, the browser() provided by the framework and |
| 1281 // the panel window we opened earlier. The tabbed browser window has 2 tabs. | 1282 // the panel window we opened earlier. The tabbed browser window has 2 tabs. |
| 1282 EXPECT_EQ(2u, BrowserList::size()); | 1283 EXPECT_EQ(2u, BrowserList::size()); |
| 1283 EXPECT_EQ(2, browser()->tab_count()); | 1284 EXPECT_EQ(2, browser()->tab_count()); |
| 1284 EXPECT_EQ(1, panel_browser->tab_count()); | 1285 EXPECT_EQ(1, panel_browser->tab_count()); |
| 1285 } | 1286 } |
| 1286 | 1287 |
| 1287 } // namespace | 1288 } // namespace |
| OLD | NEW |