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/tabs/tab_strip_model.h" | 6 #include "chrome/browser/tabs/tab_strip_model.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/browser/ui/webui/print_preview_ui.h" | 9 #include "chrome/browser/ui/webui/print_preview_ui.h" |
10 #include "chrome/test/base/browser_with_test_window_test.h" | 10 #include "chrome/test/base/browser_with_test_window_test.h" |
11 #include "chrome/test/base/testing_profile.h" | 11 #include "chrome/test/base/testing_profile.h" |
12 #include "content/browser/tab_contents/navigation_entry.h" | 12 #include "content/browser/tab_contents/navigation_entry.h" |
13 #include "content/browser/tab_contents/navigation_details.h" | 13 #include "content/browser/tab_contents/navigation_details.h" |
14 #include "content/browser/tab_contents/tab_contents.h" | 14 #include "content/browser/tab_contents/tab_contents.h" |
15 #include "content/common/notification_service.h" | 15 #include "content/common/notification_service.h" |
16 #include "content/common/url_constants.h" | 16 #include "content/public/common/url_constants.h" |
17 | 17 |
18 typedef BrowserWithTestWindowTest PrintPreviewTabControllerUnitTest; | 18 typedef BrowserWithTestWindowTest PrintPreviewTabControllerUnitTest; |
19 | 19 |
20 // Create/Get a preview tab for initiator tab. | 20 // Create/Get a preview tab for initiator tab. |
21 TEST_F(PrintPreviewTabControllerUnitTest, GetOrCreatePreviewTab) { | 21 TEST_F(PrintPreviewTabControllerUnitTest, GetOrCreatePreviewTab) { |
22 ASSERT_TRUE(browser()); | 22 ASSERT_TRUE(browser()); |
23 BrowserList::SetLastActive(browser()); | 23 BrowserList::SetLastActive(browser()); |
24 ASSERT_TRUE(BrowserList::GetLastActive()); | 24 ASSERT_TRUE(BrowserList::GetLastActive()); |
25 | 25 |
26 // Lets start with one window with one tab. | 26 // Lets start with one window with one tab. |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 tab_controller->EraseInitiatorTabInfo(preview_tab); | 197 tab_controller->EraseInitiatorTabInfo(preview_tab); |
198 | 198 |
199 // Get the print preview tab for initiator tab. | 199 // Get the print preview tab for initiator tab. |
200 TabContentsWrapper* new_preview_tab = | 200 TabContentsWrapper* new_preview_tab = |
201 tab_controller->GetOrCreatePreviewTab(initiator_tab); | 201 tab_controller->GetOrCreatePreviewTab(initiator_tab); |
202 | 202 |
203 // New preview tab is created. | 203 // New preview tab is created. |
204 EXPECT_EQ(3, browser()->tab_count()); | 204 EXPECT_EQ(3, browser()->tab_count()); |
205 EXPECT_NE(new_preview_tab, preview_tab); | 205 EXPECT_NE(new_preview_tab, preview_tab); |
206 } | 206 } |
OLD | NEW |