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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/memory/ref_counted_memory.h" | 7 #include "base/memory/ref_counted_memory.h" |
8 #include "chrome/browser/prefs/pref_service.h" | 8 #include "chrome/browser/prefs/pref_service.h" |
9 #include "chrome/browser/printing/print_preview_tab_controller.h" | 9 #include "chrome/browser/printing/print_preview_tab_controller.h" |
10 #include "chrome/browser/printing/print_view_manager.h" | 10 #include "chrome/browser/printing/print_view_manager.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 dummy_data.get()); | 92 dummy_data.get()); |
93 preview_ui->GetPrintPreviewDataForIndex( | 93 preview_ui->GetPrintPreviewDataForIndex( |
94 printing::COMPLETE_PREVIEW_DOCUMENT_INDEX, | 94 printing::COMPLETE_PREVIEW_DOCUMENT_INDEX, |
95 &data); | 95 &data); |
96 EXPECT_EQ(dummy_data->size(), data->size()); | 96 EXPECT_EQ(dummy_data->size(), data->size()); |
97 EXPECT_EQ(dummy_data.get(), data.get()); | 97 EXPECT_EQ(dummy_data.get(), data.get()); |
98 | 98 |
99 // This should not cause any memory leaks. | 99 // This should not cause any memory leaks. |
100 dummy_data = new base::RefCountedBytes(); | 100 dummy_data = new base::RefCountedBytes(); |
101 preview_ui->SetPrintPreviewDataForIndex(printing::FIRST_PAGE_INDEX, | 101 preview_ui->SetPrintPreviewDataForIndex(printing::FIRST_PAGE_INDEX, |
102 dummy_data); | 102 dummy_data.get()); |
103 | 103 |
104 // Clear the preview data. | 104 // Clear the preview data. |
105 preview_ui->ClearAllPreviewData(); | 105 preview_ui->ClearAllPreviewData(); |
106 | 106 |
107 preview_ui->GetPrintPreviewDataForIndex( | 107 preview_ui->GetPrintPreviewDataForIndex( |
108 printing::COMPLETE_PREVIEW_DOCUMENT_INDEX, | 108 printing::COMPLETE_PREVIEW_DOCUMENT_INDEX, |
109 &data); | 109 &data); |
110 EXPECT_EQ(NULL, data.get()); | 110 EXPECT_EQ(NULL, data.get()); |
111 } | 111 } |
112 | 112 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 PrintPreviewUI* preview_ui = static_cast<PrintPreviewUI*>( | 260 PrintPreviewUI* preview_ui = static_cast<PrintPreviewUI*>( |
261 preview_tab->web_contents()->GetWebUI()->GetController()); | 261 preview_tab->web_contents()->GetWebUI()->GetController()); |
262 ASSERT_TRUE(preview_ui != NULL); | 262 ASSERT_TRUE(preview_ui != NULL); |
263 | 263 |
264 preview_ui->OnPrintPreviewTabClosed(); | 264 preview_ui->OnPrintPreviewTabClosed(); |
265 | 265 |
266 EXPECT_EQ(2, browser()->tab_count()); | 266 EXPECT_EQ(2, browser()->tab_count()); |
267 EXPECT_EQ(0U, GetConstrainedWindowCount(initiator_tab)); | 267 EXPECT_EQ(0U, GetConstrainedWindowCount(initiator_tab)); |
268 EXPECT_EQ(1, initiator_tester->GetNumberOfFocusCalls()); | 268 EXPECT_EQ(1, initiator_tester->GetNumberOfFocusCalls()); |
269 } | 269 } |
OLD | NEW |