| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.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 13 matching lines...) Expand all Loading... |
| 24 "12346102356120394751634516591348710478123649165419234519234512349134"; | 24 "12346102356120394751634516591348710478123649165419234519234512349134"; |
| 25 | 25 |
| 26 size_t GetConstrainedWindowCount(TabContentsWrapper* tab) { | 26 size_t GetConstrainedWindowCount(TabContentsWrapper* tab) { |
| 27 return tab->constrained_window_tab_helper()->constrained_window_count(); | 27 return tab->constrained_window_tab_helper()->constrained_window_count(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 } // namespace | 30 } // namespace |
| 31 | 31 |
| 32 typedef BrowserWithTestWindowTest PrintPreviewUIUnitTest; | 32 typedef BrowserWithTestWindowTest PrintPreviewUIUnitTest; |
| 33 | 33 |
| 34 // Test crashs on TouchUI due to initiator tab's native view having no parent. | 34 // Test crashes on Aura due to initiator tab's native view having no parent. |
| 35 // http://crbug.com/104284 | 35 // http://crbug.com/104284 |
| 36 // Crashes on Aura due to no FocusManager. | 36 #if defined(USE_AURA) |
| 37 // http://crbug.com/105186 | 37 #define MAYBE_PrintPreviewDraftPages DISABLED_PrintPreviewDraftPages |
| 38 #if defined(TOUCH_UI) || defined(USE_AURA) | |
| 39 #define MAYBE_PrintPreviewData DISABLED_PrintPreviewData | 38 #define MAYBE_PrintPreviewData DISABLED_PrintPreviewData |
| 39 #define MAYBE_GetCurrentPrintPreviewStatus DISABLED_GetCurrentPrintPreviewStatus |
| 40 #else | 40 #else |
| 41 #define MAYBE_PrintPreviewData PrintPreviewData | 41 #define MAYBE_PrintPreviewData PrintPreviewData |
| 42 #define MAYBE_PrintPreviewDraftPages PrintPreviewDraftPages |
| 43 #define MAYBE_GetCurrentPrintPreviewStatus GetCurrentPrintPreviewStatus |
| 42 #endif | 44 #endif |
| 43 // Create/Get a preview tab for initiator tab. | 45 // Create/Get a preview tab for initiator tab. |
| 44 TEST_F(PrintPreviewUIUnitTest, MAYBE_PrintPreviewData) { | 46 TEST_F(PrintPreviewUIUnitTest, MAYBE_PrintPreviewData) { |
| 45 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview); | 47 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview); |
| 46 ASSERT_TRUE(browser()); | 48 ASSERT_TRUE(browser()); |
| 47 BrowserList::SetLastActive(browser()); | 49 BrowserList::SetLastActive(browser()); |
| 48 ASSERT_TRUE(BrowserList::GetLastActive()); | 50 ASSERT_TRUE(BrowserList::GetLastActive()); |
| 49 | 51 |
| 50 browser()->NewTab(); | 52 browser()->NewTab(); |
| 51 TabContentsWrapper* initiator_tab = | 53 TabContentsWrapper* initiator_tab = |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 96 |
| 95 // Clear the preview data. | 97 // Clear the preview data. |
| 96 preview_ui->ClearAllPreviewData(); | 98 preview_ui->ClearAllPreviewData(); |
| 97 | 99 |
| 98 preview_ui->GetPrintPreviewDataForIndex( | 100 preview_ui->GetPrintPreviewDataForIndex( |
| 99 printing::COMPLETE_PREVIEW_DOCUMENT_INDEX, | 101 printing::COMPLETE_PREVIEW_DOCUMENT_INDEX, |
| 100 &data); | 102 &data); |
| 101 EXPECT_EQ(NULL, data.get()); | 103 EXPECT_EQ(NULL, data.get()); |
| 102 } | 104 } |
| 103 | 105 |
| 104 // http://crbug.com/104284 | |
| 105 // http://crbug.com/105186 | |
| 106 #if defined(TOUCH_UI) || defined(USE_AURA) | |
| 107 #define MAYBE_PrintPreviewDraftPages DISABLED_PrintPreviewDraftPages | |
| 108 #else | |
| 109 #define MAYBE_PrintPreviewDraftPages PrintPreviewDraftPages | |
| 110 #endif | |
| 111 // Set and get the individual draft pages. | 106 // Set and get the individual draft pages. |
| 112 TEST_F(PrintPreviewUIUnitTest, MAYBE_PrintPreviewDraftPages) { | 107 TEST_F(PrintPreviewUIUnitTest, MAYBE_PrintPreviewDraftPages) { |
| 113 #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_CHROMEOS) | 108 #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_CHROMEOS) |
| 114 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview); | 109 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview); |
| 115 #endif | 110 #endif |
| 116 ASSERT_TRUE(browser()); | 111 ASSERT_TRUE(browser()); |
| 117 BrowserList::SetLastActive(browser()); | 112 BrowserList::SetLastActive(browser()); |
| 118 ASSERT_TRUE(BrowserList::GetLastActive()); | 113 ASSERT_TRUE(BrowserList::GetLastActive()); |
| 119 | 114 |
| 120 browser()->NewTab(); | 115 browser()->NewTab(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 &data); | 165 &data); |
| 171 EXPECT_EQ(dummy_data->size(), data->size()); | 166 EXPECT_EQ(dummy_data->size(), data->size()); |
| 172 EXPECT_EQ(dummy_data.get(), data.get()); | 167 EXPECT_EQ(dummy_data.get(), data.get()); |
| 173 | 168 |
| 174 // Clear the preview data. | 169 // Clear the preview data. |
| 175 preview_ui->ClearAllPreviewData(); | 170 preview_ui->ClearAllPreviewData(); |
| 176 preview_ui->GetPrintPreviewDataForIndex(printing::FIRST_PAGE_INDEX, &data); | 171 preview_ui->GetPrintPreviewDataForIndex(printing::FIRST_PAGE_INDEX, &data); |
| 177 EXPECT_EQ(NULL, data.get()); | 172 EXPECT_EQ(NULL, data.get()); |
| 178 } | 173 } |
| 179 | 174 |
| 180 // http://crbug.com/104284 | |
| 181 // http://crbug.com/105186 | |
| 182 #if defined(TOUCH_UI) || defined(USE_AURA) | |
| 183 #define MAYBE_GetCurrentPrintPreviewStatus DISABLED_GetCurrentPrintPreviewStatus | |
| 184 #else | |
| 185 #define MAYBE_GetCurrentPrintPreviewStatus GetCurrentPrintPreviewStatus | |
| 186 #endif | |
| 187 // Test the browser-side print preview cancellation functionality. | 175 // Test the browser-side print preview cancellation functionality. |
| 188 TEST_F(PrintPreviewUIUnitTest, MAYBE_GetCurrentPrintPreviewStatus) { | 176 TEST_F(PrintPreviewUIUnitTest, MAYBE_GetCurrentPrintPreviewStatus) { |
| 189 #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_CHROMEOS) | 177 #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_CHROMEOS) |
| 190 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview); | 178 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview); |
| 191 #endif | 179 #endif |
| 192 ASSERT_TRUE(browser()); | 180 ASSERT_TRUE(browser()); |
| 193 BrowserList::SetLastActive(browser()); | 181 BrowserList::SetLastActive(browser()); |
| 194 ASSERT_TRUE(BrowserList::GetLastActive()); | 182 ASSERT_TRUE(BrowserList::GetLastActive()); |
| 195 | 183 |
| 196 browser()->NewTab(); | 184 browser()->NewTab(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 cancel = false; | 228 cancel = false; |
| 241 preview_ui->GetCurrentPrintPreviewStatus(preview_ui_addr, kFirstRequestId, | 229 preview_ui->GetCurrentPrintPreviewStatus(preview_ui_addr, kFirstRequestId, |
| 242 &cancel); | 230 &cancel); |
| 243 EXPECT_TRUE(cancel); | 231 EXPECT_TRUE(cancel); |
| 244 | 232 |
| 245 cancel = true; | 233 cancel = true; |
| 246 preview_ui->GetCurrentPrintPreviewStatus(preview_ui_addr, kSecondRequestId, | 234 preview_ui->GetCurrentPrintPreviewStatus(preview_ui_addr, kSecondRequestId, |
| 247 &cancel); | 235 &cancel); |
| 248 EXPECT_FALSE(cancel); | 236 EXPECT_FALSE(cancel); |
| 249 } | 237 } |
| OLD | NEW |