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/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
9 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 9 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 browser::NavigateParams p(MakeNavigateParams()); | 65 browser::NavigateParams p(MakeNavigateParams()); |
66 p.disposition = disposition; | 66 p.disposition = disposition; |
67 browser::Navigate(&p); | 67 browser::Navigate(&p); |
68 | 68 |
69 // Nothing should have happened as a result of Navigate(); | 69 // Nothing should have happened as a result of Navigate(); |
70 EXPECT_EQ(1, browser()->tab_count()); | 70 EXPECT_EQ(1, browser()->tab_count()); |
71 EXPECT_EQ(1u, BrowserList::size()); | 71 EXPECT_EQ(1u, BrowserList::size()); |
72 EXPECT_EQ(old_url, browser()->GetSelectedTabContents()->GetURL()); | 72 EXPECT_EQ(old_url, browser()->GetSelectedTabContents()->GetURL()); |
73 } | 73 } |
74 | 74 |
75 void BrowserNavigatorTest::Observe(NotificationType type, | 75 void BrowserNavigatorTest::Observe(int type, |
76 const NotificationSource& source, | 76 const NotificationSource& source, |
77 const NotificationDetails& details) { | 77 const NotificationDetails& details) { |
78 switch (type.value) { | 78 switch (type) { |
79 case NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB: { | 79 case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: { |
80 ++this->created_tab_contents_count_; | 80 ++this->created_tab_contents_count_; |
81 break; | 81 break; |
82 } | 82 } |
83 default: | 83 default: |
84 break; | 84 break; |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 namespace { | 88 namespace { |
89 | 89 |
(...skipping 14 matching lines...) Expand all Loading... |
104 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTabExisting) { | 104 IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTabExisting) { |
105 GURL url("http://www.google.com/"); | 105 GURL url("http://www.google.com/"); |
106 GURL singleton_url1("http://maps.google.com/"); | 106 GURL singleton_url1("http://maps.google.com/"); |
107 | 107 |
108 // Register for a notification if an additional tab_contents was instantiated. | 108 // Register for a notification if an additional tab_contents was instantiated. |
109 // Opening a Singleton tab that is already opened should not be opening a new | 109 // Opening a Singleton tab that is already opened should not be opening a new |
110 // tab nor be creating a new TabContents object | 110 // tab nor be creating a new TabContents object |
111 NotificationRegistrar registrar; | 111 NotificationRegistrar registrar; |
112 | 112 |
113 // As the registrar object goes out of scope, this will get unregistered | 113 // As the registrar object goes out of scope, this will get unregistered |
114 registrar.Add(this, NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, | 114 registrar.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, |
115 NotificationService::AllSources()); | 115 NotificationService::AllSources()); |
116 | 116 |
117 browser()->AddSelectedTabWithURL(singleton_url1, PageTransition::LINK); | 117 browser()->AddSelectedTabWithURL(singleton_url1, PageTransition::LINK); |
118 browser()->AddSelectedTabWithURL(url, PageTransition::LINK); | 118 browser()->AddSelectedTabWithURL(url, PageTransition::LINK); |
119 | 119 |
120 // We should have one browser with 3 tabs, the 3rd selected. | 120 // We should have one browser with 3 tabs, the 3rd selected. |
121 EXPECT_EQ(1u, BrowserList::size()); | 121 EXPECT_EQ(1u, BrowserList::size()); |
122 EXPECT_EQ(2, browser()->active_index()); | 122 EXPECT_EQ(2, browser()->active_index()); |
123 | 123 |
124 unsigned int previous_tab_contents_count = | 124 unsigned int previous_tab_contents_count = |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); | 1024 VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); |
1025 | 1025 |
1026 // Go back to the first tab. The focus should not be in the omnibox. | 1026 // Go back to the first tab. The focus should not be in the omnibox. |
1027 browser()->SelectPreviousTab(); | 1027 browser()->SelectPreviousTab(); |
1028 EXPECT_EQ(0, browser()->active_index()); | 1028 EXPECT_EQ(0, browser()->active_index()); |
1029 EXPECT_FALSE(ui_test_utils::IsViewFocused(browser(), | 1029 EXPECT_FALSE(ui_test_utils::IsViewFocused(browser(), |
1030 VIEW_ID_LOCATION_BAR)); | 1030 VIEW_ID_LOCATION_BAR)); |
1031 } | 1031 } |
1032 | 1032 |
1033 } // namespace | 1033 } // namespace |
OLD | NEW |