| 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" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 // Set up a PrintPreviewUI for |preview_tab|. | 88 // Set up a PrintPreviewUI for |preview_tab|. |
| 89 PrintPreviewUI* preview_ui = new PrintPreviewUI(preview_tab->tab_contents()); | 89 PrintPreviewUI* preview_ui = new PrintPreviewUI(preview_tab->tab_contents()); |
| 90 // RenderViewHostManager takes ownership of |preview_ui|. | 90 // RenderViewHostManager takes ownership of |preview_ui|. |
| 91 preview_tab->tab_contents()->render_manager_for_testing()-> | 91 preview_tab->tab_contents()->render_manager_for_testing()-> |
| 92 SetWebUIPostCommit(preview_ui); | 92 SetWebUIPostCommit(preview_ui); |
| 93 | 93 |
| 94 // Simulate a reload event on |preview_tab|. | 94 // Simulate a reload event on |preview_tab|. |
| 95 scoped_ptr<NavigationEntry> entry; | 95 scoped_ptr<NavigationEntry> entry; |
| 96 entry.reset(new NavigationEntry()); | 96 entry.reset(new NavigationEntry()); |
| 97 entry->set_transition_type(PageTransition::RELOAD); | 97 entry->set_transition_type(content::PAGE_TRANSITION_RELOAD); |
| 98 content::LoadCommittedDetails details; | 98 content::LoadCommittedDetails details; |
| 99 details.type = NavigationType::SAME_PAGE; | 99 details.type = NavigationType::SAME_PAGE; |
| 100 details.entry = entry.get(); | 100 details.entry = entry.get(); |
| 101 NotificationService::current()->Notify( | 101 NotificationService::current()->Notify( |
| 102 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 102 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 103 Source<NavigationController>(&preview_tab->controller()), | 103 Source<NavigationController>(&preview_tab->controller()), |
| 104 Details<content::LoadCommittedDetails>(&details)); | 104 Details<content::LoadCommittedDetails>(&details)); |
| 105 EXPECT_EQ(initiator_tab->tab_contents()->GetTitle(), | 105 EXPECT_EQ(initiator_tab->tab_contents()->GetTitle(), |
| 106 preview_ui->initiator_tab_title_); | 106 preview_ui->initiator_tab_title_); |
| 107 } | 107 } |
| (...skipping 89 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 |