| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "chrome/browser/printing/print_preview_tab_controller.h" | 6 #include "chrome/browser/printing/print_preview_tab_controller.h" |
| 7 #include "chrome/browser/printing/print_view_manager.h" | 7 #include "chrome/browser/printing/print_view_manager.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_commands.h" | 9 #include "chrome/browser/ui/browser_commands.h" |
| 10 #include "chrome/browser/ui/browser_tabstrip.h" | 10 #include "chrome/browser/ui/browser_tabstrip.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 TabContents* preview_tab = | 112 TabContents* preview_tab = |
| 113 tab_controller->GetOrCreatePreviewTab(initiator_tab); | 113 tab_controller->GetOrCreatePreviewTab(initiator_tab); |
| 114 | 114 |
| 115 // New print preview tab is created. | 115 // New print preview tab is created. |
| 116 EXPECT_EQ(1, browser()->tab_count()); | 116 EXPECT_EQ(1, browser()->tab_count()); |
| 117 ASSERT_TRUE(preview_tab); | 117 ASSERT_TRUE(preview_tab); |
| 118 ASSERT_NE(initiator_tab, preview_tab); | 118 ASSERT_NE(initiator_tab, preview_tab); |
| 119 TabDestroyedObserver tab_destroyed_observer(preview_tab->web_contents()); | 119 TabDestroyedObserver tab_destroyed_observer(preview_tab->web_contents()); |
| 120 | 120 |
| 121 // Reload the initiator tab. | 121 // Reload the initiator tab. |
| 122 ui_test_utils::WindowedNotificationObserver notification_observer( | 122 content::WindowedNotificationObserver notification_observer( |
| 123 content::NOTIFICATION_LOAD_STOP, | 123 content::NOTIFICATION_LOAD_STOP, |
| 124 content::NotificationService::AllSources()); | 124 content::NotificationService::AllSources()); |
| 125 chrome::Reload(browser(), CURRENT_TAB); | 125 chrome::Reload(browser(), CURRENT_TAB); |
| 126 notification_observer.Wait(); | 126 notification_observer.Wait(); |
| 127 | 127 |
| 128 ASSERT_TRUE(tab_destroyed_observer.tab_destroyed()); | 128 ASSERT_TRUE(tab_destroyed_observer.tab_destroyed()); |
| 129 | 129 |
| 130 // Get the print preview tab for initiator tab. | 130 // Get the print preview tab for initiator tab. |
| 131 initiator_tab->print_view_manager()->PrintPreviewNow(); | 131 initiator_tab->print_view_manager()->PrintPreviewNow(); |
| 132 TabContents* new_preview_tab = | 132 TabContents* new_preview_tab = |
| 133 tab_controller->GetOrCreatePreviewTab(initiator_tab); | 133 tab_controller->GetOrCreatePreviewTab(initiator_tab); |
| 134 | 134 |
| 135 EXPECT_EQ(1, browser()->tab_count()); | 135 EXPECT_EQ(1, browser()->tab_count()); |
| 136 EXPECT_TRUE(new_preview_tab); | 136 EXPECT_TRUE(new_preview_tab); |
| 137 } | 137 } |
| OLD | NEW |