| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 const std::vector<content::WebContents*>& tabs() { return observed_tabs_; } | 109 const std::vector<content::WebContents*>& tabs() { return observed_tabs_; } |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 size_t observations_; | 112 size_t observations_; |
| 113 std::vector<content::WebContents*> observed_tabs_; | 113 std::vector<content::WebContents*> observed_tabs_; |
| 114 | 114 |
| 115 DISALLOW_COPY_AND_ASSIGN(TabsAddedNotificationObserver); | 115 DISALLOW_COPY_AND_ASSIGN(TabsAddedNotificationObserver); |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 #if defined(ENABLE_FULL_PRINTING) | 118 #if defined(ENABLE_PRINT_PREVIEW) |
| 119 class ScopedPreviewTestingDelegate : PrintPreviewUI::TestingDelegate { | 119 class ScopedPreviewTestingDelegate : PrintPreviewUI::TestingDelegate { |
| 120 public: | 120 public: |
| 121 explicit ScopedPreviewTestingDelegate(bool auto_cancel) | 121 explicit ScopedPreviewTestingDelegate(bool auto_cancel) |
| 122 : auto_cancel_(auto_cancel), | 122 : auto_cancel_(auto_cancel), |
| 123 total_page_count_(1), | 123 total_page_count_(1), |
| 124 rendered_page_count_(0) { | 124 rendered_page_count_(0) { |
| 125 PrintPreviewUI::SetDelegateForTesting(this); | 125 PrintPreviewUI::SetDelegateForTesting(this); |
| 126 } | 126 } |
| 127 | 127 |
| 128 ~ScopedPreviewTestingDelegate() { | 128 ~ScopedPreviewTestingDelegate() { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 } | 161 } |
| 162 | 162 |
| 163 private: | 163 private: |
| 164 bool auto_cancel_; | 164 bool auto_cancel_; |
| 165 int total_page_count_; | 165 int total_page_count_; |
| 166 int rendered_page_count_; | 166 int rendered_page_count_; |
| 167 scoped_refptr<content::MessageLoopRunner> waiting_runner_; | 167 scoped_refptr<content::MessageLoopRunner> waiting_runner_; |
| 168 gfx::Size dialog_size_; | 168 gfx::Size dialog_size_; |
| 169 }; | 169 }; |
| 170 | 170 |
| 171 #endif // ENABLE_FULL_PRINTING | 171 #endif // ENABLE_PRINT_PREVIEW |
| 172 | 172 |
| 173 #if !defined(OS_CHROMEOS) && !defined(OS_WIN) | 173 #if !defined(OS_CHROMEOS) && !defined(OS_WIN) |
| 174 bool CopyTestDataAndSetCommandLineArg( | 174 bool CopyTestDataAndSetCommandLineArg( |
| 175 const base::FilePath& test_data_file, | 175 const base::FilePath& test_data_file, |
| 176 const base::FilePath& temp_dir, | 176 const base::FilePath& temp_dir, |
| 177 const char* filename) { | 177 const char* filename) { |
| 178 base::FilePath path = temp_dir.AppendASCII( | 178 base::FilePath path = temp_dir.AppendASCII( |
| 179 filename).NormalizePathSeparators(); | 179 filename).NormalizePathSeparators(); |
| 180 if (!(base::CopyFile(test_data_file, path))) | 180 if (!(base::CopyFile(test_data_file, path))) |
| 181 return false; | 181 return false; |
| (...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_WebContentsHasFocus) { | 1109 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_WebContentsHasFocus) { |
| 1110 LoadAndLaunchPlatformApp("minimal", "Launched"); | 1110 LoadAndLaunchPlatformApp("minimal", "Launched"); |
| 1111 | 1111 |
| 1112 EXPECT_EQ(1LU, GetAppWindowCount()); | 1112 EXPECT_EQ(1LU, GetAppWindowCount()); |
| 1113 EXPECT_TRUE(GetFirstAppWindow() | 1113 EXPECT_TRUE(GetFirstAppWindow() |
| 1114 ->web_contents() | 1114 ->web_contents() |
| 1115 ->GetRenderWidgetHostView() | 1115 ->GetRenderWidgetHostView() |
| 1116 ->HasFocus()); | 1116 ->HasFocus()); |
| 1117 } | 1117 } |
| 1118 | 1118 |
| 1119 | 1119 #if defined(ENABLE_PRINT_PREVIEW) |
| 1120 #if defined(ENABLE_FULL_PRINTING) | |
| 1121 | 1120 |
| 1122 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX) | 1121 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX) |
| 1123 #define MAYBE_WindowDotPrintShouldBringUpPrintPreview \ | 1122 #define MAYBE_WindowDotPrintShouldBringUpPrintPreview \ |
| 1124 DISABLED_WindowDotPrintShouldBringUpPrintPreview | 1123 DISABLED_WindowDotPrintShouldBringUpPrintPreview |
| 1125 #else | 1124 #else |
| 1126 #define MAYBE_WindowDotPrintShouldBringUpPrintPreview \ | 1125 #define MAYBE_WindowDotPrintShouldBringUpPrintPreview \ |
| 1127 WindowDotPrintShouldBringUpPrintPreview | 1126 WindowDotPrintShouldBringUpPrintPreview |
| 1128 #endif | 1127 #endif |
| 1129 | 1128 |
| 1130 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, | 1129 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1161 gfx::Size minimum_dialog_size(410, 191); | 1160 gfx::Size minimum_dialog_size(410, 191); |
| 1162 ScopedPreviewTestingDelegate preview_delegate(false); | 1161 ScopedPreviewTestingDelegate preview_delegate(false); |
| 1163 ASSERT_TRUE(RunPlatformAppTest("platform_apps/print_api")) << message_; | 1162 ASSERT_TRUE(RunPlatformAppTest("platform_apps/print_api")) << message_; |
| 1164 preview_delegate.WaitUntilPreviewIsReady(); | 1163 preview_delegate.WaitUntilPreviewIsReady(); |
| 1165 EXPECT_GE(preview_delegate.dialog_size().width(), | 1164 EXPECT_GE(preview_delegate.dialog_size().width(), |
| 1166 minimum_dialog_size.width()); | 1165 minimum_dialog_size.width()); |
| 1167 EXPECT_GE(preview_delegate.dialog_size().height(), | 1166 EXPECT_GE(preview_delegate.dialog_size().height(), |
| 1168 minimum_dialog_size.height()); | 1167 minimum_dialog_size.height()); |
| 1169 GetFirstAppWindow()->GetBaseWindow()->Close(); | 1168 GetFirstAppWindow()->GetBaseWindow()->Close(); |
| 1170 } | 1169 } |
| 1171 #endif // ENABLE_FULL_PRINTING | 1170 #endif // ENABLE_PRINT_PREVIEW |
| 1172 | |
| 1173 | 1171 |
| 1174 #if defined(OS_CHROMEOS) | 1172 #if defined(OS_CHROMEOS) |
| 1175 | 1173 |
| 1176 class PlatformAppIncognitoBrowserTest : public PlatformAppBrowserTest, | 1174 class PlatformAppIncognitoBrowserTest : public PlatformAppBrowserTest, |
| 1177 public AppWindowRegistry::Observer { | 1175 public AppWindowRegistry::Observer { |
| 1178 public: | 1176 public: |
| 1179 virtual void SetUpCommandLine(CommandLine* command_line) override { | 1177 virtual void SetUpCommandLine(CommandLine* command_line) override { |
| 1180 // Tell chromeos to launch in Guest mode, aka incognito. | 1178 // Tell chromeos to launch in Guest mode, aka incognito. |
| 1181 command_line->AppendSwitch(switches::kIncognito); | 1179 command_line->AppendSwitch(switches::kIncognito); |
| 1182 PlatformAppBrowserTest::SetUpCommandLine(command_line); | 1180 PlatformAppBrowserTest::SetUpCommandLine(command_line); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1324 LoadAndLaunchPlatformApp("reinstall_data_cleanup", "Launched"); | 1322 LoadAndLaunchPlatformApp("reinstall_data_cleanup", "Launched"); |
| 1325 ASSERT_TRUE(extension); | 1323 ASSERT_TRUE(extension); |
| 1326 ASSERT_EQ(extension_id, extension->id()); | 1324 ASSERT_EQ(extension_id, extension->id()); |
| 1327 | 1325 |
| 1328 ResultCatcher result_catcher; | 1326 ResultCatcher result_catcher; |
| 1329 EXPECT_TRUE(result_catcher.GetNextResult()); | 1327 EXPECT_TRUE(result_catcher.GetNextResult()); |
| 1330 } | 1328 } |
| 1331 } | 1329 } |
| 1332 | 1330 |
| 1333 } // namespace extensions | 1331 } // namespace extensions |
| OLD | NEW |