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