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 "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/browser/printing/print_preview_dialog_controller.h" | 9 #include "chrome/browser/printing/print_preview_dialog_controller.h" |
10 #include "chrome/browser/printing/print_preview_test.h" | 10 #include "chrome/browser/printing/print_preview_test.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 dummy_data.get()); | 100 dummy_data.get()); |
101 preview_ui->GetPrintPreviewDataForIndex( | 101 preview_ui->GetPrintPreviewDataForIndex( |
102 printing::COMPLETE_PREVIEW_DOCUMENT_INDEX, | 102 printing::COMPLETE_PREVIEW_DOCUMENT_INDEX, |
103 &data); | 103 &data); |
104 EXPECT_EQ(dummy_data->size(), data->size()); | 104 EXPECT_EQ(dummy_data->size(), data->size()); |
105 EXPECT_EQ(dummy_data.get(), data.get()); | 105 EXPECT_EQ(dummy_data.get(), data.get()); |
106 | 106 |
107 // This should not cause any memory leaks. | 107 // This should not cause any memory leaks. |
108 dummy_data = new base::RefCountedBytes(); | 108 dummy_data = new base::RefCountedBytes(); |
109 preview_ui->SetPrintPreviewDataForIndex(printing::FIRST_PAGE_INDEX, | 109 preview_ui->SetPrintPreviewDataForIndex(printing::FIRST_PAGE_INDEX, |
110 dummy_data); | 110 dummy_data.get()); |
111 | 111 |
112 // Clear the preview data. | 112 // Clear the preview data. |
113 preview_ui->ClearAllPreviewData(); | 113 preview_ui->ClearAllPreviewData(); |
114 | 114 |
115 preview_ui->GetPrintPreviewDataForIndex( | 115 preview_ui->GetPrintPreviewDataForIndex( |
116 printing::COMPLETE_PREVIEW_DOCUMENT_INDEX, | 116 printing::COMPLETE_PREVIEW_DOCUMENT_INDEX, |
117 &data); | 117 &data); |
118 EXPECT_EQ(NULL, data.get()); | 118 EXPECT_EQ(NULL, data.get()); |
119 } | 119 } |
120 | 120 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 cancel = false; | 231 cancel = false; |
232 preview_ui->GetCurrentPrintPreviewStatus(preview_ui_addr, kFirstRequestId, | 232 preview_ui->GetCurrentPrintPreviewStatus(preview_ui_addr, kFirstRequestId, |
233 &cancel); | 233 &cancel); |
234 EXPECT_TRUE(cancel); | 234 EXPECT_TRUE(cancel); |
235 | 235 |
236 cancel = true; | 236 cancel = true; |
237 preview_ui->GetCurrentPrintPreviewStatus(preview_ui_addr, kSecondRequestId, | 237 preview_ui->GetCurrentPrintPreviewStatus(preview_ui_addr, kSecondRequestId, |
238 &cancel); | 238 &cancel); |
239 EXPECT_FALSE(cancel); | 239 EXPECT_FALSE(cancel); |
240 } | 240 } |
OLD | NEW |