| 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/launcher.h" | 5 #include "apps/launcher.h" |
| 6 #include "apps/native_app_window.h" | 6 #include "apps/native_app_window.h" |
| 7 #include "apps/shell_window.h" | 7 #include "apps/shell_window.h" |
| 8 #include "apps/shell_window_registry.h" | 8 #include "apps/shell_window_registry.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "chrome/browser/extensions/component_loader.h" | 24 #include "chrome/browser/extensions/component_loader.h" |
| 25 #include "chrome/browser/extensions/event_router.h" | 25 #include "chrome/browser/extensions/event_router.h" |
| 26 #include "chrome/browser/extensions/extension_browsertest.h" | 26 #include "chrome/browser/extensions/extension_browsertest.h" |
| 27 #include "chrome/browser/extensions/extension_service.h" | 27 #include "chrome/browser/extensions/extension_service.h" |
| 28 #include "chrome/browser/extensions/extension_system.h" | 28 #include "chrome/browser/extensions/extension_system.h" |
| 29 #include "chrome/browser/extensions/extension_test_message_listener.h" | 29 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 30 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 30 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 31 #include "chrome/browser/ui/browser.h" | 31 #include "chrome/browser/ui/browser.h" |
| 32 #include "chrome/browser/ui/extensions/application_launch.h" | 32 #include "chrome/browser/ui/extensions/application_launch.h" |
| 33 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 33 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 34 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h" | |
| 35 #include "chrome/common/chrome_switches.h" | 34 #include "chrome/common/chrome_switches.h" |
| 36 #include "chrome/common/extensions/api/app_runtime.h" | 35 #include "chrome/common/extensions/api/app_runtime.h" |
| 37 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
| 38 #include "chrome/common/url_constants.h" | 37 #include "chrome/common/url_constants.h" |
| 39 #include "chrome/test/base/test_switches.h" | 38 #include "chrome/test/base/test_switches.h" |
| 40 #include "chrome/test/base/ui_test_utils.h" | 39 #include "chrome/test/base/ui_test_utils.h" |
| 41 #include "components/user_prefs/pref_registry_syncable.h" | 40 #include "components/user_prefs/pref_registry_syncable.h" |
| 42 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 41 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 43 #include "content/public/browser/devtools_agent_host.h" | 42 #include "content/public/browser/devtools_agent_host.h" |
| 44 #include "content/public/browser/render_process_host.h" | 43 #include "content/public/browser/render_process_host.h" |
| (...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 LoadAndLaunchPlatformApp("minimal"); | 1029 LoadAndLaunchPlatformApp("minimal"); |
| 1031 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); | 1030 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); |
| 1032 | 1031 |
| 1033 EXPECT_EQ(1LU, GetShellWindowCount()); | 1032 EXPECT_EQ(1LU, GetShellWindowCount()); |
| 1034 ShellWindowRegistry::ShellWindowList shell_windows = ShellWindowRegistry::Get( | 1033 ShellWindowRegistry::ShellWindowList shell_windows = ShellWindowRegistry::Get( |
| 1035 browser()->profile())->shell_windows(); | 1034 browser()->profile())->shell_windows(); |
| 1036 EXPECT_TRUE((*shell_windows.begin())->web_contents()-> | 1035 EXPECT_TRUE((*shell_windows.begin())->web_contents()-> |
| 1037 GetRenderWidgetHostView()->HasFocus()); | 1036 GetRenderWidgetHostView()->HasFocus()); |
| 1038 } | 1037 } |
| 1039 | 1038 |
| 1040 class PlatformAppPrintBrowserTest : public extensions::PlatformAppBrowserTest { | |
| 1041 public: | |
| 1042 PlatformAppPrintBrowserTest() {} | |
| 1043 | |
| 1044 // Ensures print tests use the print preview panel even for non-Chrome | |
| 1045 // branded Chromium builds. | |
| 1046 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | |
| 1047 command_line->AppendSwitch(switches::kEnablePrintPreview); | |
| 1048 PlatformAppBrowserTest::SetUpCommandLine(command_line); | |
| 1049 } | |
| 1050 }; | |
| 1051 | |
| 1052 // Currently this test only works if the PDF preview plug-in is available. This | |
| 1053 // plug-in will only be available in Chrome release builds or if it has been | |
| 1054 // manually copied from a Chrome release build. To run this test when the | |
| 1055 // plug-in has been manually copied, manually comment out the next three lines | |
| 1056 // and the corresponding #endif. | |
| 1057 #if !defined(GOOGLE_CHROME_BUILD) | |
| 1058 #define MAYBE_WindowDotPrintWorks DISABLED_WindowDotPrintWorks | |
| 1059 #else | |
| 1060 #define MAYBE_WindowDotPrintWorks WindowDotPrintWorks | |
| 1061 #endif | |
| 1062 | |
| 1063 IN_PROC_BROWSER_TEST_F(PlatformAppPrintBrowserTest, MAYBE_WindowDotPrintWorks) { | |
| 1064 PrintPreviewUI::SetAutoCancelForTesting(true); | |
| 1065 ASSERT_TRUE(RunPlatformAppTest("platform_apps/print_api")) << message_; | |
| 1066 PrintPreviewUI::SetAutoCancelForTesting(false); | |
| 1067 } | |
| 1068 | |
| 1069 | 1039 |
| 1070 #if defined(OS_CHROMEOS) | 1040 #if defined(OS_CHROMEOS) |
| 1071 | 1041 |
| 1072 class PlatformAppIncognitoBrowserTest : public PlatformAppBrowserTest, | 1042 class PlatformAppIncognitoBrowserTest : public PlatformAppBrowserTest, |
| 1073 public ShellWindowRegistry::Observer { | 1043 public ShellWindowRegistry::Observer { |
| 1074 public: | 1044 public: |
| 1075 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 1045 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 1076 // Tell chromeos to launch in Guest mode, aka incognito. | 1046 // Tell chromeos to launch in Guest mode, aka incognito. |
| 1077 command_line->AppendSwitch(switches::kIncognito); | 1047 command_line->AppendSwitch(switches::kIncognito); |
| 1078 PlatformAppBrowserTest::SetUpCommandLine(command_line); | 1048 PlatformAppBrowserTest::SetUpCommandLine(command_line); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1122 | 1092 |
| 1123 while (!ContainsKey(opener_app_ids_, file_manager->id())) { | 1093 while (!ContainsKey(opener_app_ids_, file_manager->id())) { |
| 1124 content::RunAllPendingInMessageLoop(); | 1094 content::RunAllPendingInMessageLoop(); |
| 1125 } | 1095 } |
| 1126 } | 1096 } |
| 1127 | 1097 |
| 1128 #endif // defined(OS_CHROMEOS) | 1098 #endif // defined(OS_CHROMEOS) |
| 1129 | 1099 |
| 1130 | 1100 |
| 1131 } // namespace extensions | 1101 } // namespace extensions |
| OLD | NEW |