| 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 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 const unsigned char blob1[] = | 22 const unsigned char blob1[] = |
| 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 PrintPreviewUITest; | 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 #if defined(TOUCH_UI) |
| 36 #define MAYBE_PrintPreviewData DISABLED_PrintPreviewData | 36 #define MAYBE_PrintPreviewData DISABLED_PrintPreviewData |
| 37 #else | 37 #else |
| 38 #define MAYBE_PrintPreviewData PrintPreviewData | 38 #define MAYBE_PrintPreviewData PrintPreviewData |
| 39 #endif | 39 #endif |
| 40 // Create/Get a preview tab for initiator tab. | 40 // Create/Get a preview tab for initiator tab. |
| 41 TEST_F(PrintPreviewUITest, MAYBE_PrintPreviewData) { | 41 TEST_F(PrintPreviewUIUnitTest, MAYBE_PrintPreviewData) { |
| 42 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview); | 42 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview); |
| 43 ASSERT_TRUE(browser()); | 43 ASSERT_TRUE(browser()); |
| 44 BrowserList::SetLastActive(browser()); | 44 BrowserList::SetLastActive(browser()); |
| 45 ASSERT_TRUE(BrowserList::GetLastActive()); | 45 ASSERT_TRUE(BrowserList::GetLastActive()); |
| 46 | 46 |
| 47 browser()->NewTab(); | 47 browser()->NewTab(); |
| 48 TabContentsWrapper* initiator_tab = | 48 TabContentsWrapper* initiator_tab = |
| 49 browser()->GetSelectedTabContentsWrapper(); | 49 browser()->GetSelectedTabContentsWrapper(); |
| 50 ASSERT_TRUE(initiator_tab); | 50 ASSERT_TRUE(initiator_tab); |
| 51 EXPECT_EQ(0U, GetConstrainedWindowCount(initiator_tab)); | 51 EXPECT_EQ(0U, GetConstrainedWindowCount(initiator_tab)); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 EXPECT_EQ(NULL, data.get()); | 97 EXPECT_EQ(NULL, data.get()); |
| 98 } | 98 } |
| 99 | 99 |
| 100 // http://crbug.com/104284 | 100 // http://crbug.com/104284 |
| 101 #if defined(TOUCH_UI) | 101 #if defined(TOUCH_UI) |
| 102 #define MAYBE_PrintPreviewDraftPages DISABLED_PrintPreviewDraftPages | 102 #define MAYBE_PrintPreviewDraftPages DISABLED_PrintPreviewDraftPages |
| 103 #else | 103 #else |
| 104 #define MAYBE_PrintPreviewDraftPages PrintPreviewDraftPages | 104 #define MAYBE_PrintPreviewDraftPages PrintPreviewDraftPages |
| 105 #endif | 105 #endif |
| 106 // Set and get the individual draft pages. | 106 // Set and get the individual draft pages. |
| 107 TEST_F(PrintPreviewUITest, MAYBE_PrintPreviewDraftPages) { | 107 TEST_F(PrintPreviewUIUnitTest, MAYBE_PrintPreviewDraftPages) { |
| 108 #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_CHROMEOS) | 108 #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_CHROMEOS) |
| 109 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview); | 109 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview); |
| 110 #endif | 110 #endif |
| 111 ASSERT_TRUE(browser()); | 111 ASSERT_TRUE(browser()); |
| 112 BrowserList::SetLastActive(browser()); | 112 BrowserList::SetLastActive(browser()); |
| 113 ASSERT_TRUE(BrowserList::GetLastActive()); | 113 ASSERT_TRUE(BrowserList::GetLastActive()); |
| 114 | 114 |
| 115 browser()->NewTab(); | 115 browser()->NewTab(); |
| 116 TabContentsWrapper* initiator_tab = | 116 TabContentsWrapper* initiator_tab = |
| 117 browser()->GetSelectedTabContentsWrapper(); | 117 browser()->GetSelectedTabContentsWrapper(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 EXPECT_EQ(NULL, data.get()); | 171 EXPECT_EQ(NULL, data.get()); |
| 172 } | 172 } |
| 173 | 173 |
| 174 // http://crbug.com/104284 | 174 // http://crbug.com/104284 |
| 175 #if defined(TOUCH_UI) | 175 #if defined(TOUCH_UI) |
| 176 #define MAYBE_GetCurrentPrintPreviewStatus DISABLED_GetCurrentPrintPreviewStatus | 176 #define MAYBE_GetCurrentPrintPreviewStatus DISABLED_GetCurrentPrintPreviewStatus |
| 177 #else | 177 #else |
| 178 #define MAYBE_GetCurrentPrintPreviewStatus GetCurrentPrintPreviewStatus | 178 #define MAYBE_GetCurrentPrintPreviewStatus GetCurrentPrintPreviewStatus |
| 179 #endif | 179 #endif |
| 180 // Test the browser-side print preview cancellation functionality. | 180 // Test the browser-side print preview cancellation functionality. |
| 181 TEST_F(PrintPreviewUITest, MAYBE_GetCurrentPrintPreviewStatus) { | 181 TEST_F(PrintPreviewUIUnitTest, MAYBE_GetCurrentPrintPreviewStatus) { |
| 182 #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_CHROMEOS) | 182 #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_CHROMEOS) |
| 183 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview); | 183 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePrintPreview); |
| 184 #endif | 184 #endif |
| 185 ASSERT_TRUE(browser()); | 185 ASSERT_TRUE(browser()); |
| 186 BrowserList::SetLastActive(browser()); | 186 BrowserList::SetLastActive(browser()); |
| 187 ASSERT_TRUE(BrowserList::GetLastActive()); | 187 ASSERT_TRUE(BrowserList::GetLastActive()); |
| 188 | 188 |
| 189 browser()->NewTab(); | 189 browser()->NewTab(); |
| 190 TabContentsWrapper* initiator_tab = | 190 TabContentsWrapper* initiator_tab = |
| 191 browser()->GetSelectedTabContentsWrapper(); | 191 browser()->GetSelectedTabContentsWrapper(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 cancel = false; | 232 cancel = false; |
| 233 preview_ui->GetCurrentPrintPreviewStatus(preview_ui_addr, kFirstRequestId, | 233 preview_ui->GetCurrentPrintPreviewStatus(preview_ui_addr, kFirstRequestId, |
| 234 &cancel); | 234 &cancel); |
| 235 EXPECT_TRUE(cancel); | 235 EXPECT_TRUE(cancel); |
| 236 | 236 |
| 237 cancel = true; | 237 cancel = true; |
| 238 preview_ui->GetCurrentPrintPreviewStatus(preview_ui_addr, kSecondRequestId, | 238 preview_ui->GetCurrentPrintPreviewStatus(preview_ui_addr, kSecondRequestId, |
| 239 &cancel); | 239 &cancel); |
| 240 EXPECT_FALSE(cancel); | 240 EXPECT_FALSE(cancel); |
| 241 } | 241 } |
| OLD | NEW |