OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/tabs/tab_strip_model.h" | 9 #include "chrome/browser/tabs/tab_strip_model.h" |
10 #include "chrome/browser/ui/browser_list.h" | 10 #include "chrome/browser/ui/browser_list.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 browser::NavigateParams p(MakeNavigateParams()); | 61 browser::NavigateParams p(MakeNavigateParams()); |
62 p.disposition = disposition; | 62 p.disposition = disposition; |
63 browser::Navigate(&p); | 63 browser::Navigate(&p); |
64 | 64 |
65 // Nothing should have happened as a result of Navigate(); | 65 // Nothing should have happened as a result of Navigate(); |
66 EXPECT_EQ(1, browser()->tab_count()); | 66 EXPECT_EQ(1, browser()->tab_count()); |
67 EXPECT_EQ(1u, BrowserList::size()); | 67 EXPECT_EQ(1u, BrowserList::size()); |
68 EXPECT_EQ(old_url, browser()->GetSelectedTabContents()->GetURL()); | 68 EXPECT_EQ(old_url, browser()->GetSelectedTabContents()->GetURL()); |
69 } | 69 } |
70 | 70 |
71 void BrowserNavigatorTest::Observe(NotificationType type, | 71 void BrowserNavigatorTest::Observe(int type, |
72 const NotificationSource& source, | 72 const NotificationSource& source, |
73 const NotificationDetails& details) { | 73 const NotificationDetails& details) { |
74 switch (type.value) { | 74 switch (type) { |
75 case NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB: { | 75 case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: { |
76 ++this->created_tab_contents_count_; | 76 ++this->created_tab_contents_count_; |
77 break; | 77 break; |
78 } | 78 } |
79 default: | 79 default: |
80 break; | 80 break; |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 namespace { | 84 namespace { |
85 | 85 |
(...skipping 14 matching lines...) Expand all Loading... |
100 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTabExisting) { | 100 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTabExisting) { |
101 GURL url("http://www.google.com/"); | 101 GURL url("http://www.google.com/"); |
102 GURL singleton_url1("http://maps.google.com/"); | 102 GURL singleton_url1("http://maps.google.com/"); |
103 | 103 |
104 // Register for a notification if an additional tab_contents was instantiated. | 104 // Register for a notification if an additional tab_contents was instantiated. |
105 // Opening a Singleton tab that is already opened should not be opening a new | 105 // Opening a Singleton tab that is already opened should not be opening a new |
106 // tab nor be creating a new TabContents object | 106 // tab nor be creating a new TabContents object |
107 NotificationRegistrar registrar; | 107 NotificationRegistrar registrar; |
108 | 108 |
109 // As the registrar object goes out of scope, this will get unregistered | 109 // As the registrar object goes out of scope, this will get unregistered |
110 registrar.Add(this, NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, | 110 registrar.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, |
111 NotificationService::AllSources()); | 111 NotificationService::AllSources()); |
112 | 112 |
113 browser()->AddSelectedTabWithURL(singleton_url1, PageTransition::LINK); | 113 browser()->AddSelectedTabWithURL(singleton_url1, PageTransition::LINK); |
114 browser()->AddSelectedTabWithURL(url, PageTransition::LINK); | 114 browser()->AddSelectedTabWithURL(url, PageTransition::LINK); |
115 | 115 |
116 // We should have one browser with 3 tabs, the 3rd selected. | 116 // We should have one browser with 3 tabs, the 3rd selected. |
117 EXPECT_EQ(1u, BrowserList::size()); | 117 EXPECT_EQ(1u, BrowserList::size()); |
118 EXPECT_EQ(2, browser()->active_index()); | 118 EXPECT_EQ(2, browser()->active_index()); |
119 | 119 |
120 unsigned int previous_tab_contents_count = | 120 unsigned int previous_tab_contents_count = |
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 ui_test_utils::WaitForNavigationInCurrentTab(browser()); | 982 ui_test_utils::WaitForNavigationInCurrentTab(browser()); |
983 | 983 |
984 browser()->OpenOptionsDialog(); | 984 browser()->OpenOptionsDialog(); |
985 ui_test_utils::WaitForNavigationInCurrentTab(browser()); | 985 ui_test_utils::WaitForNavigationInCurrentTab(browser()); |
986 EXPECT_EQ(2, browser()->tab_count()); | 986 EXPECT_EQ(2, browser()->tab_count()); |
987 EXPECT_EQ(GURL("chrome://settings/browser"), | 987 EXPECT_EQ(GURL("chrome://settings/browser"), |
988 browser()->GetSelectedTabContents()->GetURL()); | 988 browser()->GetSelectedTabContents()->GetURL()); |
989 } | 989 } |
990 | 990 |
991 } // namespace | 991 } // namespace |
OLD | NEW |