| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/printing/print_dialog_cloud.h" | 5 #include "chrome/browser/printing/print_dialog_cloud.h" |
| 6 #include "chrome/browser/printing/print_dialog_cloud_internal.h" | 6 #include "chrome/browser/printing/print_dialog_cloud_internal.h" |
| 7 | 7 |
| 8 #include <functional> | 8 #include <functional> |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" | 17 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" |
| 18 #include "chrome/browser/ui/browser_list.h" | 18 #include "chrome/browser/ui/browser_list.h" |
| 19 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 19 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 20 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
| 21 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
| 22 #include "chrome/test/base/in_process_browser_test.h" | 22 #include "chrome/test/base/in_process_browser_test.h" |
| 23 #include "chrome/test/base/ui_test_utils.h" | 23 #include "chrome/test/base/ui_test_utils.h" |
| 24 #include "content/browser/browser_thread.h" | 24 #include "content/browser/browser_thread.h" |
| 25 #include "content/browser/renderer_host/render_view_host.h" | 25 #include "content/browser/renderer_host/render_view_host.h" |
| 26 #include "content/browser/tab_contents/tab_contents.h" | 26 #include "content/browser/tab_contents/tab_contents.h" |
| 27 #include "content/public/browser/notification_service.h" |
| 27 #include "content/public/browser/notification_types.h" | 28 #include "content/public/browser/notification_types.h" |
| 28 #include "net/url_request/url_request_filter.h" | 29 #include "net/url_request/url_request_filter.h" |
| 29 #include "net/url_request/url_request_test_job.h" | 30 #include "net/url_request/url_request_test_job.h" |
| 30 #include "net/url_request/url_request_test_util.h" | 31 #include "net/url_request/url_request_test_util.h" |
| 31 | 32 |
| 32 namespace { | 33 namespace { |
| 33 | 34 |
| 34 class TestData { | 35 class TestData { |
| 35 public: | 36 public: |
| 36 static TestData* GetInstance() { | 37 static TestData* GetInstance() { |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 AddTestHandlers(); | 241 AddTestHandlers(); |
| 241 | 242 |
| 242 TestController::GetInstance()->set_use_delegate(true); | 243 TestController::GetInstance()->set_use_delegate(true); |
| 243 | 244 |
| 244 ui_test_utils::RunMessageLoop(); | 245 ui_test_utils::RunMessageLoop(); |
| 245 | 246 |
| 246 ASSERT_TRUE(TestController::GetInstance()->result()); | 247 ASSERT_TRUE(TestController::GetInstance()->result()); |
| 247 | 248 |
| 248 // Close the dialog before finishing the test. | 249 // Close the dialog before finishing the test. |
| 249 ui_test_utils::WindowedNotificationObserver signal( | 250 ui_test_utils::WindowedNotificationObserver signal( |
| 250 content::NOTIFICATION_TAB_CLOSED, NotificationService::AllSources()); | 251 content::NOTIFICATION_TAB_CLOSED, |
| 252 content::NotificationService::AllSources()); |
| 251 EXPECT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_ESCAPE, | 253 EXPECT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_ESCAPE, |
| 252 false, false, false, false)); | 254 false, false, false, false)); |
| 253 signal.Wait(); | 255 signal.Wait(); |
| 254 } | 256 } |
| 255 | 257 |
| 256 #if defined(OS_CHROMEOS) | 258 #if defined(OS_CHROMEOS) |
| 257 // Disabled until the extern URL is live so that the Print menu item | 259 // Disabled until the extern URL is live so that the Print menu item |
| 258 // can be enabled for Chromium OS. | 260 // can be enabled for Chromium OS. |
| 259 IN_PROC_BROWSER_TEST_F(PrintDialogCloudTest, DISABLED_DialogGrabbed) { | 261 IN_PROC_BROWSER_TEST_F(PrintDialogCloudTest, DISABLED_DialogGrabbed) { |
| 260 BrowserList::SetLastActive(browser()); | 262 BrowserList::SetLastActive(browser()); |
| 261 ASSERT_TRUE(BrowserList::GetLastActive()); | 263 ASSERT_TRUE(BrowserList::GetLastActive()); |
| 262 | 264 |
| 263 AddTestHandlers(); | 265 AddTestHandlers(); |
| 264 | 266 |
| 265 // This goes back one step further for the Chrome OS case, to making | 267 // This goes back one step further for the Chrome OS case, to making |
| 266 // sure 'window.print()' gets to the right place. | 268 // sure 'window.print()' gets to the right place. |
| 267 ASSERT_TRUE(browser()->GetSelectedTabContents()); | 269 ASSERT_TRUE(browser()->GetSelectedTabContents()); |
| 268 ASSERT_TRUE(browser()->GetSelectedTabContents()->render_view_host()); | 270 ASSERT_TRUE(browser()->GetSelectedTabContents()->render_view_host()); |
| 269 | 271 |
| 270 string16 window_print = ASCIIToUTF16("window.print()"); | 272 string16 window_print = ASCIIToUTF16("window.print()"); |
| 271 browser()->GetSelectedTabContents()->render_view_host()-> | 273 browser()->GetSelectedTabContents()->render_view_host()-> |
| 272 ExecuteJavascriptInWebFrame(string16(), window_print); | 274 ExecuteJavascriptInWebFrame(string16(), window_print); |
| 273 | 275 |
| 274 ui_test_utils::RunMessageLoop(); | 276 ui_test_utils::RunMessageLoop(); |
| 275 | 277 |
| 276 ASSERT_TRUE(TestController::GetInstance()->result()); | 278 ASSERT_TRUE(TestController::GetInstance()->result()); |
| 277 } | 279 } |
| 278 #endif | 280 #endif |
| OLD | NEW |