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_preview_test.h" | 10 #include "chrome/browser/printing/print_preview_test.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 base::RefCountedBytes* CreateTestData() { | 31 base::RefCountedBytes* CreateTestData() { |
32 const unsigned char blob1[] = | 32 const unsigned char blob1[] = |
33 "12346102356120394751634516591348710478123649165419234519234512349134"; | 33 "12346102356120394751634516591348710478123649165419234519234512349134"; |
34 std::vector<unsigned char> preview_data(blob1, blob1 + sizeof(blob1)); | 34 std::vector<unsigned char> preview_data(blob1, blob1 + sizeof(blob1)); |
35 return new base::RefCountedBytes(preview_data); | 35 return new base::RefCountedBytes(preview_data); |
36 } | 36 } |
37 | 37 |
38 size_t GetConstrainedWindowCount(WebContents* tab) { | 38 size_t GetConstrainedWindowCount(WebContents* tab) { |
39 ConstrainedWindowTabHelper* constrained_window_tab_helper = | 39 ConstrainedWindowTabHelper* constrained_window_tab_helper = |
40 ConstrainedWindowTabHelper::FromWebContents(tab); | 40 ConstrainedWindowTabHelper::FromWebContents(tab); |
41 return constrained_window_tab_helper->constrained_window_count(); | 41 return constrained_window_tab_helper->dialog_count(); |
42 } | 42 } |
43 | 43 |
44 } // namespace | 44 } // namespace |
45 | 45 |
46 class PrintPreviewUIUnitTest : public PrintPreviewTest { | 46 class PrintPreviewUIUnitTest : public PrintPreviewTest { |
47 public: | 47 public: |
48 PrintPreviewUIUnitTest(); | 48 PrintPreviewUIUnitTest(); |
49 virtual ~PrintPreviewUIUnitTest(); | 49 virtual ~PrintPreviewUIUnitTest(); |
50 | 50 |
51 protected: | 51 protected: |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 PrintPreviewUI* preview_ui = static_cast<PrintPreviewUI*>( | 264 PrintPreviewUI* preview_ui = static_cast<PrintPreviewUI*>( |
265 preview_tab->GetWebUI()->GetController()); | 265 preview_tab->GetWebUI()->GetController()); |
266 ASSERT_TRUE(preview_ui != NULL); | 266 ASSERT_TRUE(preview_ui != NULL); |
267 | 267 |
268 preview_ui->OnPrintPreviewTabClosed(); | 268 preview_ui->OnPrintPreviewTabClosed(); |
269 | 269 |
270 EXPECT_EQ(2, browser()->tab_count()); | 270 EXPECT_EQ(2, browser()->tab_count()); |
271 EXPECT_EQ(0U, GetConstrainedWindowCount(initiator_tab)); | 271 EXPECT_EQ(0U, GetConstrainedWindowCount(initiator_tab)); |
272 EXPECT_EQ(1, initiator_tester->GetNumberOfFocusCalls()); | 272 EXPECT_EQ(1, initiator_tester->GetNumberOfFocusCalls()); |
273 } | 273 } |
OLD | NEW |