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