Chromium Code Reviews| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "apps/launcher.h" | 9 #include "apps/launcher.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 35 #include "chrome/test/base/test_switches.h" | 35 #include "chrome/test/base/test_switches.h" |
| 36 #include "chrome/test/base/ui_test_utils.h" | 36 #include "chrome/test/base/ui_test_utils.h" |
| 37 #include "components/pref_registry/pref_registry_syncable.h" | 37 #include "components/pref_registry/pref_registry_syncable.h" |
| 38 #include "components/prefs/pref_service.h" | 38 #include "components/prefs/pref_service.h" |
| 39 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 39 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 40 #include "content/public/browser/devtools_agent_host.h" | 40 #include "content/public/browser/devtools_agent_host.h" |
| 41 #include "content/public/browser/host_zoom_map.h" | 41 #include "content/public/browser/host_zoom_map.h" |
| 42 #include "content/public/browser/render_process_host.h" | 42 #include "content/public/browser/render_process_host.h" |
| 43 #include "content/public/browser/render_widget_host_view.h" | 43 #include "content/public/browser/render_widget_host_view.h" |
| 44 #include "content/public/test/browser_test_utils.h" | 44 #include "content/public/test/browser_test_utils.h" |
| 45 #include "content/public/test/test_utils.h" | 45 #include "content/public/test/test_utils.h" |
|
tapted
2017/02/09 01:10:02
is one or both of these content..test_utils.h head
rbpotter
2017/02/09 01:56:40
Done.
| |
| 46 #include "extensions/browser/app_window/app_window.h" | 46 #include "extensions/browser/app_window/app_window.h" |
| 47 #include "extensions/browser/app_window/app_window_registry.h" | 47 #include "extensions/browser/app_window/app_window_registry.h" |
| 48 #include "extensions/browser/app_window/native_app_window.h" | 48 #include "extensions/browser/app_window/native_app_window.h" |
| 49 #include "extensions/browser/event_router.h" | 49 #include "extensions/browser/event_router.h" |
| 50 #include "extensions/browser/extension_prefs.h" | 50 #include "extensions/browser/extension_prefs.h" |
| 51 #include "extensions/browser/extension_registry.h" | 51 #include "extensions/browser/extension_registry.h" |
| 52 #include "extensions/browser/extension_registry_observer.h" | 52 #include "extensions/browser/extension_registry_observer.h" |
| 53 #include "extensions/browser/pref_names.h" | 53 #include "extensions/browser/pref_names.h" |
| 54 #include "extensions/common/api/app_runtime.h" | 54 #include "extensions/common/api/app_runtime.h" |
| 55 #include "extensions/common/constants.h" | 55 #include "extensions/common/constants.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 // PrintPreviewUI::TestingDelegate implementation. | 140 // PrintPreviewUI::TestingDelegate implementation. |
| 141 void DidGetPreviewPageCount(int page_count) override { | 141 void DidGetPreviewPageCount(int page_count) override { |
| 142 total_page_count_ = page_count; | 142 total_page_count_ = page_count; |
| 143 } | 143 } |
| 144 | 144 |
| 145 // PrintPreviewUI::TestingDelegate implementation. | 145 // PrintPreviewUI::TestingDelegate implementation. |
| 146 void DidRenderPreviewPage(content::WebContents* preview_dialog) override { | 146 void DidRenderPreviewPage(content::WebContents* preview_dialog) override { |
| 147 dialog_size_ = preview_dialog->GetContainerBounds().size(); | 147 dialog_size_ = preview_dialog->GetContainerBounds().size(); |
| 148 ++rendered_page_count_; | 148 ++rendered_page_count_; |
| 149 CHECK(rendered_page_count_ <= total_page_count_); | 149 CHECK(rendered_page_count_ <= total_page_count_); |
| 150 if (waiting_runner_.get() && rendered_page_count_ == total_page_count_) { | 150 if (rendered_page_count_ == total_page_count_ && run_loop_) { |
| 151 waiting_runner_->Quit(); | 151 run_loop_->Quit(); |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 | 154 |
| 155 void WaitUntilPreviewIsReady() { | 155 void WaitUntilPreviewIsReady() { |
| 156 CHECK(!waiting_runner_.get()); | 156 CHECK(!run_loop_); |
|
tapted
2017/02/09 01:10:02
This is no longer being cleared after removing `wa
rbpotter
2017/02/09 01:56:40
Done. Thanks for the suggestion.
| |
| 157 if (rendered_page_count_ < total_page_count_) { | 157 if (rendered_page_count_ < total_page_count_) { |
| 158 waiting_runner_ = new content::MessageLoopRunner; | 158 run_loop_ = base::MakeUnique<base::RunLoop>(); |
| 159 waiting_runner_->Run(); | 159 run_loop_->Run(); |
| 160 waiting_runner_ = NULL; | |
| 161 } | 160 } |
| 162 } | 161 } |
| 163 | 162 |
| 164 gfx::Size dialog_size() { | 163 gfx::Size dialog_size() { |
| 165 return dialog_size_; | 164 return dialog_size_; |
| 166 } | 165 } |
| 167 | 166 |
| 168 private: | 167 private: |
| 169 bool auto_cancel_; | 168 bool auto_cancel_; |
| 170 int total_page_count_; | 169 int total_page_count_; |
| 171 int rendered_page_count_; | 170 int rendered_page_count_; |
| 172 scoped_refptr<content::MessageLoopRunner> waiting_runner_; | 171 std::unique_ptr<base::RunLoop> run_loop_; |
| 173 gfx::Size dialog_size_; | 172 gfx::Size dialog_size_; |
| 174 }; | 173 }; |
| 175 | 174 |
| 176 #endif // ENABLE_PRINT_PREVIEW | 175 #endif // ENABLE_PRINT_PREVIEW |
| 177 | 176 |
| 178 #if !defined(OS_CHROMEOS) && !defined(OS_WIN) | 177 #if !defined(OS_CHROMEOS) && !defined(OS_WIN) |
| 179 bool CopyTestDataAndGetTestFilePath( | 178 bool CopyTestDataAndGetTestFilePath( |
| 180 const base::FilePath& test_data_file, | 179 const base::FilePath& test_data_file, |
| 181 const base::FilePath& temp_dir, | 180 const base::FilePath& temp_dir, |
| 182 const char* filename, | 181 const char* filename, |
| (...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1131 | 1130 |
| 1132 EXPECT_EQ(1LU, GetAppWindowCount()); | 1131 EXPECT_EQ(1LU, GetAppWindowCount()); |
| 1133 EXPECT_TRUE(GetFirstAppWindow() | 1132 EXPECT_TRUE(GetFirstAppWindow() |
| 1134 ->web_contents() | 1133 ->web_contents() |
| 1135 ->GetRenderWidgetHostView() | 1134 ->GetRenderWidgetHostView() |
| 1136 ->HasFocus()); | 1135 ->HasFocus()); |
| 1137 } | 1136 } |
| 1138 | 1137 |
| 1139 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) | 1138 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
| 1140 | 1139 |
| 1141 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX) | |
| 1142 #define MAYBE_WindowDotPrintShouldBringUpPrintPreview \ | |
| 1143 DISABLED_WindowDotPrintShouldBringUpPrintPreview | |
| 1144 #else | |
| 1145 #define MAYBE_WindowDotPrintShouldBringUpPrintPreview \ | |
| 1146 WindowDotPrintShouldBringUpPrintPreview | |
| 1147 #endif | |
| 1148 | |
| 1149 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, | 1140 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, |
| 1150 MAYBE_WindowDotPrintShouldBringUpPrintPreview) { | 1141 WindowDotPrintShouldBringUpPrintPreview) { |
| 1151 ScopedPreviewTestingDelegate preview_delegate(true); | 1142 ScopedPreviewTestingDelegate preview_delegate(false); |
|
tapted
2017/02/09 01:10:02
in the bug you say this was the only test passing
rbpotter
2017/02/09 01:56:40
Done.
| |
| 1152 ASSERT_TRUE(RunPlatformAppTest("platform_apps/print_api")) << message_; | 1143 ASSERT_TRUE(RunPlatformAppTest("platform_apps/print_api")) << message_; |
| 1153 preview_delegate.WaitUntilPreviewIsReady(); | 1144 preview_delegate.WaitUntilPreviewIsReady(); |
| 1154 } | 1145 } |
| 1155 | 1146 |
| 1156 // This test verifies that http://crbug.com/297179 is fixed. | 1147 // This test verifies that http://crbug.com/297179 is fixed. |
| 1157 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, | 1148 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, |
| 1158 DISABLED_ClosingWindowWhilePrintingShouldNotCrash) { | 1149 DISABLED_ClosingWindowWhilePrintingShouldNotCrash) { |
| 1159 ScopedPreviewTestingDelegate preview_delegate(false); | 1150 ScopedPreviewTestingDelegate preview_delegate(false); |
| 1160 ASSERT_TRUE(RunPlatformAppTest("platform_apps/print_api")) << message_; | 1151 ASSERT_TRUE(RunPlatformAppTest("platform_apps/print_api")) << message_; |
| 1161 preview_delegate.WaitUntilPreviewIsReady(); | 1152 preview_delegate.WaitUntilPreviewIsReady(); |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1379 // https://crbug.com/620194. | 1370 // https://crbug.com/620194. |
| 1380 #define MAYBE_AppWindowIframe DISABLED_AppWindowIframe | 1371 #define MAYBE_AppWindowIframe DISABLED_AppWindowIframe |
| 1381 // Sends chrome.test.sendMessage from chrome.app.window.create's callback. | 1372 // Sends chrome.test.sendMessage from chrome.app.window.create's callback. |
| 1382 // The app window also adds an <iframe> to the page during window.onload. | 1373 // The app window also adds an <iframe> to the page during window.onload. |
| 1383 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_AppWindowIframe) { | 1374 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_AppWindowIframe) { |
| 1384 LoadAndLaunchPlatformApp("app_window_send_message", | 1375 LoadAndLaunchPlatformApp("app_window_send_message", |
| 1385 "APP_WINDOW_CREATE_CALLBACK"); | 1376 "APP_WINDOW_CREATE_CALLBACK"); |
| 1386 } | 1377 } |
| 1387 | 1378 |
| 1388 } // namespace extensions | 1379 } // namespace extensions |
| OLD | NEW |