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 14 matching lines...) Expand all Loading... |
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 crashs on TouchUI 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 // Crashes on Aura due to no FocusManager. |
| 36 // http://crbug.com/105186 |
| 37 #if defined(TOUCH_UI) || defined(USE_AURA) |
36 #define MAYBE_PrintPreviewData DISABLED_PrintPreviewData | 38 #define MAYBE_PrintPreviewData DISABLED_PrintPreviewData |
37 #else | 39 #else |
38 #define MAYBE_PrintPreviewData PrintPreviewData | 40 #define MAYBE_PrintPreviewData PrintPreviewData |
39 #endif | 41 #endif |
40 // Create/Get a preview tab for initiator tab. | 42 // Create/Get a preview tab for initiator tab. |
41 TEST_F(PrintPreviewUIUnitTest, MAYBE_PrintPreviewData) { | 43 TEST_F(PrintPreviewUIUnitTest, MAYBE_PrintPreviewData) { |
42 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview); | 44 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview); |
43 ASSERT_TRUE(browser()); | 45 ASSERT_TRUE(browser()); |
44 BrowserList::SetLastActive(browser()); | 46 BrowserList::SetLastActive(browser()); |
45 ASSERT_TRUE(BrowserList::GetLastActive()); | 47 ASSERT_TRUE(BrowserList::GetLastActive()); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // Clear the preview data. | 93 // Clear the preview data. |
92 preview_ui->ClearAllPreviewData(); | 94 preview_ui->ClearAllPreviewData(); |
93 | 95 |
94 preview_ui->GetPrintPreviewDataForIndex( | 96 preview_ui->GetPrintPreviewDataForIndex( |
95 printing::COMPLETE_PREVIEW_DOCUMENT_INDEX, | 97 printing::COMPLETE_PREVIEW_DOCUMENT_INDEX, |
96 &data); | 98 &data); |
97 EXPECT_EQ(NULL, data.get()); | 99 EXPECT_EQ(NULL, data.get()); |
98 } | 100 } |
99 | 101 |
100 // http://crbug.com/104284 | 102 // http://crbug.com/104284 |
101 #if defined(TOUCH_UI) | 103 // http://crbug.com/105186 |
| 104 #if defined(TOUCH_UI) || defined(USE_AURA) |
102 #define MAYBE_PrintPreviewDraftPages DISABLED_PrintPreviewDraftPages | 105 #define MAYBE_PrintPreviewDraftPages DISABLED_PrintPreviewDraftPages |
103 #else | 106 #else |
104 #define MAYBE_PrintPreviewDraftPages PrintPreviewDraftPages | 107 #define MAYBE_PrintPreviewDraftPages PrintPreviewDraftPages |
105 #endif | 108 #endif |
106 // Set and get the individual draft pages. | 109 // Set and get the individual draft pages. |
107 TEST_F(PrintPreviewUIUnitTest, MAYBE_PrintPreviewDraftPages) { | 110 TEST_F(PrintPreviewUIUnitTest, MAYBE_PrintPreviewDraftPages) { |
108 #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_CHROMEOS) | 111 #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_CHROMEOS) |
109 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview); | 112 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview); |
110 #endif | 113 #endif |
111 ASSERT_TRUE(browser()); | 114 ASSERT_TRUE(browser()); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 EXPECT_EQ(dummy_data->size(), data->size()); | 168 EXPECT_EQ(dummy_data->size(), data->size()); |
166 EXPECT_EQ(dummy_data.get(), data.get()); | 169 EXPECT_EQ(dummy_data.get(), data.get()); |
167 | 170 |
168 // Clear the preview data. | 171 // Clear the preview data. |
169 preview_ui->ClearAllPreviewData(); | 172 preview_ui->ClearAllPreviewData(); |
170 preview_ui->GetPrintPreviewDataForIndex(printing::FIRST_PAGE_INDEX, &data); | 173 preview_ui->GetPrintPreviewDataForIndex(printing::FIRST_PAGE_INDEX, &data); |
171 EXPECT_EQ(NULL, data.get()); | 174 EXPECT_EQ(NULL, data.get()); |
172 } | 175 } |
173 | 176 |
174 // http://crbug.com/104284 | 177 // http://crbug.com/104284 |
175 #if defined(TOUCH_UI) | 178 // http://crbug.com/105186 |
| 179 #if defined(TOUCH_UI) || defined(USE_AURA) |
176 #define MAYBE_GetCurrentPrintPreviewStatus DISABLED_GetCurrentPrintPreviewStatus | 180 #define MAYBE_GetCurrentPrintPreviewStatus DISABLED_GetCurrentPrintPreviewStatus |
177 #else | 181 #else |
178 #define MAYBE_GetCurrentPrintPreviewStatus GetCurrentPrintPreviewStatus | 182 #define MAYBE_GetCurrentPrintPreviewStatus GetCurrentPrintPreviewStatus |
179 #endif | 183 #endif |
180 // Test the browser-side print preview cancellation functionality. | 184 // Test the browser-side print preview cancellation functionality. |
181 TEST_F(PrintPreviewUIUnitTest, MAYBE_GetCurrentPrintPreviewStatus) { | 185 TEST_F(PrintPreviewUIUnitTest, MAYBE_GetCurrentPrintPreviewStatus) { |
182 #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_CHROMEOS) | 186 #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_CHROMEOS) |
183 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview); | 187 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview); |
184 #endif | 188 #endif |
185 ASSERT_TRUE(browser()); | 189 ASSERT_TRUE(browser()); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 cancel = false; | 236 cancel = false; |
233 preview_ui->GetCurrentPrintPreviewStatus(preview_ui_addr, kFirstRequestId, | 237 preview_ui->GetCurrentPrintPreviewStatus(preview_ui_addr, kFirstRequestId, |
234 &cancel); | 238 &cancel); |
235 EXPECT_TRUE(cancel); | 239 EXPECT_TRUE(cancel); |
236 | 240 |
237 cancel = true; | 241 cancel = true; |
238 preview_ui->GetCurrentPrintPreviewStatus(preview_ui_addr, kSecondRequestId, | 242 preview_ui->GetCurrentPrintPreviewStatus(preview_ui_addr, kSecondRequestId, |
239 &cancel); | 243 &cancel); |
240 EXPECT_FALSE(cancel); | 244 EXPECT_FALSE(cancel); |
241 } | 245 } |
OLD | NEW |