| 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 "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 const std::vector<content::WebContents*>& tabs() { return observed_tabs_; } | 108 const std::vector<content::WebContents*>& tabs() { return observed_tabs_; } |
| 109 | 109 |
| 110 private: | 110 private: |
| 111 size_t observations_; | 111 size_t observations_; |
| 112 std::vector<content::WebContents*> observed_tabs_; | 112 std::vector<content::WebContents*> observed_tabs_; |
| 113 | 113 |
| 114 DISALLOW_COPY_AND_ASSIGN(TabsAddedNotificationObserver); | 114 DISALLOW_COPY_AND_ASSIGN(TabsAddedNotificationObserver); |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 #if defined(ENABLE_FULL_PRINTING) |
| 117 class ScopedPreviewTestingDelegate : PrintPreviewUI::TestingDelegate { | 118 class ScopedPreviewTestingDelegate : PrintPreviewUI::TestingDelegate { |
| 118 public: | 119 public: |
| 119 explicit ScopedPreviewTestingDelegate(bool auto_cancel) | 120 explicit ScopedPreviewTestingDelegate(bool auto_cancel) |
| 120 : auto_cancel_(auto_cancel), | 121 : auto_cancel_(auto_cancel), |
| 121 total_page_count_(1), | 122 total_page_count_(1), |
| 122 rendered_page_count_(0) { | 123 rendered_page_count_(0) { |
| 123 PrintPreviewUI::SetDelegateForTesting(this); | 124 PrintPreviewUI::SetDelegateForTesting(this); |
| 124 } | 125 } |
| 125 | 126 |
| 126 ~ScopedPreviewTestingDelegate() { | 127 ~ScopedPreviewTestingDelegate() { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 163 } |
| 163 | 164 |
| 164 private: | 165 private: |
| 165 bool auto_cancel_; | 166 bool auto_cancel_; |
| 166 int total_page_count_; | 167 int total_page_count_; |
| 167 int rendered_page_count_; | 168 int rendered_page_count_; |
| 168 scoped_refptr<content::MessageLoopRunner> waiting_runner_; | 169 scoped_refptr<content::MessageLoopRunner> waiting_runner_; |
| 169 gfx::Size dialog_size_; | 170 gfx::Size dialog_size_; |
| 170 }; | 171 }; |
| 171 | 172 |
| 173 #endif // ENABLE_FULL_PRINTING |
| 174 |
| 172 #if !defined(OS_CHROMEOS) && !defined(OS_WIN) | 175 #if !defined(OS_CHROMEOS) && !defined(OS_WIN) |
| 173 bool CopyTestDataAndSetCommandLineArg( | 176 bool CopyTestDataAndSetCommandLineArg( |
| 174 const base::FilePath& test_data_file, | 177 const base::FilePath& test_data_file, |
| 175 const base::FilePath& temp_dir, | 178 const base::FilePath& temp_dir, |
| 176 const char* filename) { | 179 const char* filename) { |
| 177 base::FilePath path = temp_dir.AppendASCII( | 180 base::FilePath path = temp_dir.AppendASCII( |
| 178 filename).NormalizePathSeparators(); | 181 filename).NormalizePathSeparators(); |
| 179 if (!(base::CopyFile(test_data_file, path))) | 182 if (!(base::CopyFile(test_data_file, path))) |
| 180 return false; | 183 return false; |
| 181 | 184 |
| (...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_WebContentsHasFocus) { | 1106 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_WebContentsHasFocus) { |
| 1104 LoadAndLaunchPlatformApp("minimal", "Launched"); | 1107 LoadAndLaunchPlatformApp("minimal", "Launched"); |
| 1105 | 1108 |
| 1106 EXPECT_EQ(1LU, GetAppWindowCount()); | 1109 EXPECT_EQ(1LU, GetAppWindowCount()); |
| 1107 EXPECT_TRUE(GetFirstAppWindow() | 1110 EXPECT_TRUE(GetFirstAppWindow() |
| 1108 ->web_contents() | 1111 ->web_contents() |
| 1109 ->GetRenderWidgetHostView() | 1112 ->GetRenderWidgetHostView() |
| 1110 ->HasFocus()); | 1113 ->HasFocus()); |
| 1111 } | 1114 } |
| 1112 | 1115 |
| 1116 |
| 1117 #if defined(ENABLE_FULL_PRINTING) |
| 1118 |
| 1113 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX) | 1119 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX) |
| 1114 #define MAYBE_WindowDotPrintShouldBringUpPrintPreview \ | 1120 #define MAYBE_WindowDotPrintShouldBringUpPrintPreview \ |
| 1115 DISABLED_WindowDotPrintShouldBringUpPrintPreview | 1121 DISABLED_WindowDotPrintShouldBringUpPrintPreview |
| 1116 #else | 1122 #else |
| 1117 #define MAYBE_WindowDotPrintShouldBringUpPrintPreview \ | 1123 #define MAYBE_WindowDotPrintShouldBringUpPrintPreview \ |
| 1118 WindowDotPrintShouldBringUpPrintPreview | 1124 WindowDotPrintShouldBringUpPrintPreview |
| 1119 #endif | 1125 #endif |
| 1120 | 1126 |
| 1121 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, | 1127 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, |
| 1122 MAYBE_WindowDotPrintShouldBringUpPrintPreview) { | 1128 MAYBE_WindowDotPrintShouldBringUpPrintPreview) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1152 gfx::Size minimum_dialog_size(410, 191); | 1158 gfx::Size minimum_dialog_size(410, 191); |
| 1153 ScopedPreviewTestingDelegate preview_delegate(false); | 1159 ScopedPreviewTestingDelegate preview_delegate(false); |
| 1154 ASSERT_TRUE(RunPlatformAppTest("platform_apps/print_api")) << message_; | 1160 ASSERT_TRUE(RunPlatformAppTest("platform_apps/print_api")) << message_; |
| 1155 preview_delegate.WaitUntilPreviewIsReady(); | 1161 preview_delegate.WaitUntilPreviewIsReady(); |
| 1156 EXPECT_GE(preview_delegate.dialog_size().width(), | 1162 EXPECT_GE(preview_delegate.dialog_size().width(), |
| 1157 minimum_dialog_size.width()); | 1163 minimum_dialog_size.width()); |
| 1158 EXPECT_GE(preview_delegate.dialog_size().height(), | 1164 EXPECT_GE(preview_delegate.dialog_size().height(), |
| 1159 minimum_dialog_size.height()); | 1165 minimum_dialog_size.height()); |
| 1160 GetFirstAppWindow()->GetBaseWindow()->Close(); | 1166 GetFirstAppWindow()->GetBaseWindow()->Close(); |
| 1161 } | 1167 } |
| 1168 #endif // ENABLE_FULL_PRINTING |
| 1162 | 1169 |
| 1163 | 1170 |
| 1164 #if defined(OS_CHROMEOS) | 1171 #if defined(OS_CHROMEOS) |
| 1165 | 1172 |
| 1166 class PlatformAppIncognitoBrowserTest : public PlatformAppBrowserTest, | 1173 class PlatformAppIncognitoBrowserTest : public PlatformAppBrowserTest, |
| 1167 public AppWindowRegistry::Observer { | 1174 public AppWindowRegistry::Observer { |
| 1168 public: | 1175 public: |
| 1169 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 1176 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 1170 // Tell chromeos to launch in Guest mode, aka incognito. | 1177 // Tell chromeos to launch in Guest mode, aka incognito. |
| 1171 command_line->AppendSwitch(switches::kIncognito); | 1178 command_line->AppendSwitch(switches::kIncognito); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1314 LoadAndLaunchPlatformApp("reinstall_data_cleanup", "Launched"); | 1321 LoadAndLaunchPlatformApp("reinstall_data_cleanup", "Launched"); |
| 1315 ASSERT_TRUE(extension); | 1322 ASSERT_TRUE(extension); |
| 1316 ASSERT_EQ(extension_id, extension->id()); | 1323 ASSERT_EQ(extension_id, extension->id()); |
| 1317 | 1324 |
| 1318 ExtensionApiTest::ResultCatcher result_catcher; | 1325 ExtensionApiTest::ResultCatcher result_catcher; |
| 1319 EXPECT_TRUE(result_catcher.GetNextResult()); | 1326 EXPECT_TRUE(result_catcher.GetNextResult()); |
| 1320 } | 1327 } |
| 1321 } | 1328 } |
| 1322 | 1329 |
| 1323 } // namespace extensions | 1330 } // namespace extensions |
| OLD | NEW |