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/printing/print_preview_tab_controller.h" | 5 #include "chrome/browser/printing/print_preview_tab_controller.h" |
6 #include "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
7 #include "chrome/browser/ui/browser_list.h" | 7 #include "chrome/browser/ui/browser_list.h" |
8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 8 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 EXPECT_EQ(2, browser()->tab_count()); | 170 EXPECT_EQ(2, browser()->tab_count()); |
171 EXPECT_EQ(newest_preview_tab, preview_tab); | 171 EXPECT_EQ(newest_preview_tab, preview_tab); |
172 } | 172 } |
173 | 173 |
174 // Test that print preview tabs are placed correctly. | 174 // Test that print preview tabs are placed correctly. |
175 IN_PROC_BROWSER_TEST_F(PrintPreviewTabControllerBrowserTest, | 175 IN_PROC_BROWSER_TEST_F(PrintPreviewTabControllerBrowserTest, |
176 OpenPreviewTabInCorrectPosition) { | 176 OpenPreviewTabInCorrectPosition) { |
177 const int kTabCount = 4; | 177 const int kTabCount = 4; |
178 // Create kTabCount - 1 tabs since we start with 1 tab already. | 178 // Create kTabCount - 1 tabs since we start with 1 tab already. |
179 for (int i = 0; i < kTabCount - 1; ++i) { | 179 for (int i = 0; i < kTabCount - 1; ++i) { |
180 browser::NavigateParams p(browser(), GURL(), PageTransition::LINK); | 180 browser::NavigateParams p(browser(), GURL(), content::PAGE_TRANSITION_LINK); |
181 p.disposition = NEW_FOREGROUND_TAB; | 181 p.disposition = NEW_FOREGROUND_TAB; |
182 browser::Navigate(&p); | 182 browser::Navigate(&p); |
183 } | 183 } |
184 EXPECT_EQ(kTabCount, browser()->tab_count()); | 184 EXPECT_EQ(kTabCount, browser()->tab_count()); |
185 | 185 |
186 // Create a print preview tab. | 186 // Create a print preview tab. |
187 scoped_refptr<printing::PrintPreviewTabController> | 187 scoped_refptr<printing::PrintPreviewTabController> |
188 tab_controller(new printing::PrintPreviewTabController()); | 188 tab_controller(new printing::PrintPreviewTabController()); |
189 ASSERT_TRUE(tab_controller); | 189 ASSERT_TRUE(tab_controller); |
190 | 190 |
(...skipping 10 matching lines...) Expand all Loading... |
201 browser()->GetTabContentsWrapperAt(kInitiatorTabIndex + 1)); | 201 browser()->GetTabContentsWrapperAt(kInitiatorTabIndex + 1)); |
202 EXPECT_EQ(preview_tab, browser()->GetSelectedTabContentsWrapper()); | 202 EXPECT_EQ(preview_tab, browser()->GetSelectedTabContentsWrapper()); |
203 } | 203 } |
204 | 204 |
205 // Test that print preview tabs created by pop-up windows are placed correctly. | 205 // Test that print preview tabs created by pop-up windows are placed correctly. |
206 IN_PROC_BROWSER_TEST_F(PrintPreviewTabControllerBrowserTest, | 206 IN_PROC_BROWSER_TEST_F(PrintPreviewTabControllerBrowserTest, |
207 OpenPreviewTabFromPopupInCorrectPosition) { | 207 OpenPreviewTabFromPopupInCorrectPosition) { |
208 const int kTabCount = 4; | 208 const int kTabCount = 4; |
209 // Create kTabCount - 1 tabs since we start with 1 tab already. | 209 // Create kTabCount - 1 tabs since we start with 1 tab already. |
210 for (int i = 0; i < kTabCount - 1; ++i) { | 210 for (int i = 0; i < kTabCount - 1; ++i) { |
211 browser::NavigateParams p(browser(), GURL(), PageTransition::LINK); | 211 browser::NavigateParams p(browser(), GURL(), content::PAGE_TRANSITION_LINK); |
212 p.disposition = NEW_FOREGROUND_TAB; | 212 p.disposition = NEW_FOREGROUND_TAB; |
213 browser::Navigate(&p); | 213 browser::Navigate(&p); |
214 } | 214 } |
215 EXPECT_EQ(kTabCount, browser()->tab_count()); | 215 EXPECT_EQ(kTabCount, browser()->tab_count()); |
216 | 216 |
217 // Create a popup | 217 // Create a popup |
218 browser::NavigateParams p(browser(), GURL(), PageTransition::LINK); | 218 browser::NavigateParams p(browser(), GURL(), content::PAGE_TRANSITION_LINK); |
219 p.disposition = NEW_POPUP; | 219 p.disposition = NEW_POPUP; |
220 ui_test_utils::NavigateToURL(&p); | 220 ui_test_utils::NavigateToURL(&p); |
221 | 221 |
222 | 222 |
223 #if defined(OS_CHROMEOS) | 223 #if defined(OS_CHROMEOS) |
224 // Navigate() should have opened a new tab on CrOS. | 224 // Navigate() should have opened a new tab on CrOS. |
225 EXPECT_EQ(browser(), p.browser); | 225 EXPECT_EQ(browser(), p.browser); |
226 EXPECT_EQ(Browser::TYPE_TABBED, p.browser->type()); | 226 EXPECT_EQ(Browser::TYPE_TABBED, p.browser->type()); |
227 #else | 227 #else |
228 // Navigate() should have opened a new popup window. | 228 // Navigate() should have opened a new popup window. |
(...skipping 16 matching lines...) Expand all Loading... |
245 // Increment position since CrOS opened a new tab instead of a popup. | 245 // Increment position since CrOS opened a new tab instead of a popup. |
246 tab_position++; | 246 tab_position++; |
247 #endif | 247 #endif |
248 | 248 |
249 // Check the preview tab's location. | 249 // Check the preview tab's location. |
250 EXPECT_EQ(preview_tab, browser()->GetTabContentsWrapperAt(tab_position)); | 250 EXPECT_EQ(preview_tab, browser()->GetTabContentsWrapperAt(tab_position)); |
251 EXPECT_EQ(preview_tab, browser()->GetSelectedTabContentsWrapper()); | 251 EXPECT_EQ(preview_tab, browser()->GetSelectedTabContentsWrapper()); |
252 } | 252 } |
253 | 253 |
254 } // namespace | 254 } // namespace |
OLD | NEW |