OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "apps/app_window.h" | 5 #include "apps/app_window.h" |
6 #include "apps/app_window_registry.h" | 6 #include "apps/app_window_registry.h" |
7 #include "apps/common/api/app_runtime.h" | 7 #include "apps/common/api/app_runtime.h" |
8 #include "apps/launcher.h" | 8 #include "apps/launcher.h" |
9 #include "apps/ui/native_app_window.h" | 9 #include "apps/ui/native_app_window.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 LoadAndLaunchPlatformApp("minimal"); | 1094 LoadAndLaunchPlatformApp("minimal"); |
1095 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); | 1095 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); |
1096 | 1096 |
1097 EXPECT_EQ(1LU, GetAppWindowCount()); | 1097 EXPECT_EQ(1LU, GetAppWindowCount()); |
1098 EXPECT_TRUE(GetFirstAppWindow() | 1098 EXPECT_TRUE(GetFirstAppWindow() |
1099 ->web_contents() | 1099 ->web_contents() |
1100 ->GetRenderWidgetHostView() | 1100 ->GetRenderWidgetHostView() |
1101 ->HasFocus()); | 1101 ->HasFocus()); |
1102 } | 1102 } |
1103 | 1103 |
1104 #if defined(OS_WIN) || defined(OS_LINUX) | 1104 // The next three tests will only run automatically with Chrome branded builds |
| 1105 // because they require the PDF preview plug-in. To run these tests manually for |
| 1106 // Chromium (non-Chrome branded) builds in a development environment: |
| 1107 // |
| 1108 // 1) Remove "MAYBE_" in the first line of each test definition |
| 1109 // 2) Build Chromium browser_tests |
| 1110 // 3) Make a copy of the PDF plug-in from a recent version of Chrome (Canary |
| 1111 // or a recent development build) to your Chromium build: |
| 1112 // - On Linux and Chrome OS, copy /opt/google/chrome/libpdf.so to |
| 1113 // <path-to-your-src>/out/Debug |
| 1114 // - On OS X, copy PDF.plugin from |
| 1115 // <recent-chrome-app-folder>/*/*/*/*/"Internet Plug-Ins" to |
| 1116 // <path-to-your-src>/out/Debug/Chromium.app/*/*/*/*/"Internet Plug-Ins" |
| 1117 // 4) Run browser_tests with the --enable-print-preview flag |
| 1118 |
| 1119 #if !defined(GOOGLE_CHROME_BUILD) || \ |
| 1120 (defined(GOOGLE_CHROME_BUILD) && (defined(OS_WIN) || defined(OS_LINUX))) |
1105 #define MAYBE_WindowDotPrintShouldBringUpPrintPreview \ | 1121 #define MAYBE_WindowDotPrintShouldBringUpPrintPreview \ |
1106 DISABLED_WindowDotPrintShouldBringUpPrintPreview | 1122 DISABLED_WindowDotPrintShouldBringUpPrintPreview |
1107 #else | 1123 #else |
1108 #define MAYBE_WindowDotPrintShouldBringUpPrintPreview \ | 1124 #define MAYBE_WindowDotPrintShouldBringUpPrintPreview \ |
1109 WindowDotPrintShouldBringUpPrintPreview | 1125 WindowDotPrintShouldBringUpPrintPreview |
1110 #endif | 1126 #endif |
1111 | 1127 |
1112 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, | 1128 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, |
1113 MAYBE_WindowDotPrintShouldBringUpPrintPreview) { | 1129 MAYBE_WindowDotPrintShouldBringUpPrintPreview) { |
1114 ScopedPreviewTestingDelegate preview_delegate(true); | 1130 ScopedPreviewTestingDelegate preview_delegate(true); |
1115 ASSERT_TRUE(RunPlatformAppTest("platform_apps/print_api")) << message_; | 1131 ASSERT_TRUE(RunPlatformAppTest("platform_apps/print_api")) << message_; |
1116 preview_delegate.WaitUntilPreviewIsReady(); | 1132 preview_delegate.WaitUntilPreviewIsReady(); |
1117 } | 1133 } |
1118 | 1134 |
| 1135 #if !defined(GOOGLE_CHROME_BUILD) |
| 1136 #define MAYBE_ClosingWindowWhilePrintingShouldNotCrash \ |
| 1137 DISABLED_ClosingWindowWhilePrintingShouldNotCrash |
| 1138 #else |
| 1139 #define MAYBE_ClosingWindowWhilePrintingShouldNotCrash \ |
| 1140 ClosingWindowWhilePrintingShouldNotCrash |
| 1141 #endif |
| 1142 |
1119 // This test verifies that http://crbug.com/297179 is fixed. | 1143 // This test verifies that http://crbug.com/297179 is fixed. |
1120 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, | 1144 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, |
1121 ClosingWindowWhilePrintingShouldNotCrash) { | 1145 MAYBE_ClosingWindowWhilePrintingShouldNotCrash) { |
1122 ScopedPreviewTestingDelegate preview_delegate(false); | 1146 ScopedPreviewTestingDelegate preview_delegate(false); |
1123 ASSERT_TRUE(RunPlatformAppTest("platform_apps/print_api")) << message_; | 1147 ASSERT_TRUE(RunPlatformAppTest("platform_apps/print_api")) << message_; |
1124 preview_delegate.WaitUntilPreviewIsReady(); | 1148 preview_delegate.WaitUntilPreviewIsReady(); |
1125 GetFirstAppWindow()->GetBaseWindow()->Close(); | 1149 GetFirstAppWindow()->GetBaseWindow()->Close(); |
1126 } | 1150 } |
1127 | 1151 |
1128 // This test currently only passes on OS X (on other platforms the print preview | 1152 // This test currently only passes on OS X (on other platforms the print preview |
1129 // dialog's size is limited by the size of the window being printed). | 1153 // dialog's size is limited by the size of the window being printed). |
1130 #if !defined(OS_MACOSX) | 1154 #if !defined(GOOGLE_CHROME_BUILD) || !defined(OS_MACOSX) |
1131 #define MAYBE_PrintPreviewShouldNotBeTooSmall \ | 1155 #define MAYBE_PrintPreviewShouldNotBeTooSmall \ |
1132 DISABLED_PrintPreviewShouldNotBeTooSmall | 1156 DISABLED_PrintPreviewShouldNotBeTooSmall |
1133 #else | 1157 #else |
1134 #define MAYBE_PrintPreviewShouldNotBeTooSmall \ | 1158 #define MAYBE_PrintPreviewShouldNotBeTooSmall \ |
1135 PrintPreviewShouldNotBeTooSmall | 1159 PrintPreviewShouldNotBeTooSmall |
1136 #endif | 1160 #endif |
1137 | 1161 |
1138 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, | 1162 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, |
1139 MAYBE_PrintPreviewShouldNotBeTooSmall) { | 1163 MAYBE_PrintPreviewShouldNotBeTooSmall) { |
1140 // Print preview dialogs with widths less than 410 pixels will have preview | 1164 // Print preview dialogs with widths less than 410 pixels will have preview |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 | 1340 |
1317 ExtensionApiTest::ResultCatcher result_catcher; | 1341 ExtensionApiTest::ResultCatcher result_catcher; |
1318 | 1342 |
1319 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); | 1343 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); |
1320 | 1344 |
1321 EXPECT_TRUE(result_catcher.GetNextResult()); | 1345 EXPECT_TRUE(result_catcher.GetNextResult()); |
1322 } | 1346 } |
1323 } | 1347 } |
1324 | 1348 |
1325 } // namespace extensions | 1349 } // namespace extensions |
OLD | NEW |