Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(395)

Side by Side Diff: chrome/browser/apps/app_browsertest.cc

Issue 23054002: Added basic browser test for window.print() from Chrome apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unnecessary code that was breaking builds Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/webui/print_preview/print_preview_ui.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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"
34 #include "chrome/common/chrome_switches.h" 35 #include "chrome/common/chrome_switches.h"
35 #include "chrome/common/extensions/api/app_runtime.h" 36 #include "chrome/common/extensions/api/app_runtime.h"
36 #include "chrome/common/pref_names.h" 37 #include "chrome/common/pref_names.h"
37 #include "chrome/common/url_constants.h" 38 #include "chrome/common/url_constants.h"
38 #include "chrome/test/base/test_switches.h" 39 #include "chrome/test/base/test_switches.h"
39 #include "chrome/test/base/ui_test_utils.h" 40 #include "chrome/test/base/ui_test_utils.h"
40 #include "components/user_prefs/pref_registry_syncable.h" 41 #include "components/user_prefs/pref_registry_syncable.h"
41 #include "components/web_modal/web_contents_modal_dialog_manager.h" 42 #include "components/web_modal/web_contents_modal_dialog_manager.h"
42 #include "content/public/browser/devtools_agent_host.h" 43 #include "content/public/browser/devtools_agent_host.h"
43 #include "content/public/browser/render_process_host.h" 44 #include "content/public/browser/render_process_host.h"
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 LoadAndLaunchPlatformApp("minimal"); 1030 LoadAndLaunchPlatformApp("minimal");
1030 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); 1031 ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
1031 1032
1032 EXPECT_EQ(1LU, GetShellWindowCount()); 1033 EXPECT_EQ(1LU, GetShellWindowCount());
1033 ShellWindowRegistry::ShellWindowList shell_windows = ShellWindowRegistry::Get( 1034 ShellWindowRegistry::ShellWindowList shell_windows = ShellWindowRegistry::Get(
1034 browser()->profile())->shell_windows(); 1035 browser()->profile())->shell_windows();
1035 EXPECT_TRUE((*shell_windows.begin())->web_contents()-> 1036 EXPECT_TRUE((*shell_windows.begin())->web_contents()->
1036 GetRenderWidgetHostView()->HasFocus()); 1037 GetRenderWidgetHostView()->HasFocus());
1037 } 1038 }
1038 1039
1040 // Currently this test only works if the PDF preview plug-in is available. This
1041 // will only happen in Chrome release builds or if the plug-in has been manually
1042 // copied from a Chrome release build. In the former case, this test will run
1043 // automatically. In the later case, it can be run manually by commenting out
1044 // the next three lines and the corresponding #endif and then running
1045 // browser_tests with a --enable-print-preview flag.
1046 #if !defined(GOOGLE_CHROME_BUILD)
1047 #define MAYBE_WindowDotPrintWorks DISABLED_WindowDotPrintWorks
1048 #else
1049 #define MAYBE_WindowDotPrintWorks WindowDotPrintWorks
1050 #endif
1051
1052 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_WindowDotPrintWorks) {
1053 PrintPreviewUI::SetAutoCancelForTesting(true);
1054 ASSERT_TRUE(RunPlatformAppTest("platform_apps/print_api")) << message_;
1055 PrintPreviewUI::SetAutoCancelForTesting(false);
1056 }
1057
1039 1058
1040 #if defined(OS_CHROMEOS) 1059 #if defined(OS_CHROMEOS)
1041 1060
1042 class PlatformAppIncognitoBrowserTest : public PlatformAppBrowserTest, 1061 class PlatformAppIncognitoBrowserTest : public PlatformAppBrowserTest,
1043 public ShellWindowRegistry::Observer { 1062 public ShellWindowRegistry::Observer {
1044 public: 1063 public:
1045 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 1064 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
1046 // Tell chromeos to launch in Guest mode, aka incognito. 1065 // Tell chromeos to launch in Guest mode, aka incognito.
1047 command_line->AppendSwitch(switches::kIncognito); 1066 command_line->AppendSwitch(switches::kIncognito);
1048 PlatformAppBrowserTest::SetUpCommandLine(command_line); 1067 PlatformAppBrowserTest::SetUpCommandLine(command_line);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 1111
1093 while (!ContainsKey(opener_app_ids_, file_manager->id())) { 1112 while (!ContainsKey(opener_app_ids_, file_manager->id())) {
1094 content::RunAllPendingInMessageLoop(); 1113 content::RunAllPendingInMessageLoop();
1095 } 1114 }
1096 } 1115 }
1097 1116
1098 #endif // defined(OS_CHROMEOS) 1117 #endif // defined(OS_CHROMEOS)
1099 1118
1100 1119
1101 } // namespace extensions 1120 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/print_preview/print_preview_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698