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/bind.h" | 10 #include "base/bind.h" |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
15 #include "base/threading/thread_restrictions.h" | 15 #include "base/threading/thread_restrictions.h" |
16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" | 18 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" |
19 #include "chrome/browser/ui/browser_list.h" | 19 #include "chrome/browser/ui/browser_list.h" |
20 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 20 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
21 #include "chrome/common/chrome_paths.h" | 21 #include "chrome/common/chrome_paths.h" |
22 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
23 #include "chrome/test/base/in_process_browser_test.h" | 23 #include "chrome/test/base/in_process_browser_test.h" |
24 #include "chrome/test/base/ui_test_utils.h" | 24 #include "chrome/test/base/ui_test_utils.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" | |
27 #include "content/public/browser/notification_service.h" | 26 #include "content/public/browser/notification_service.h" |
28 #include "content/public/browser/notification_types.h" | 27 #include "content/public/browser/notification_types.h" |
| 28 #include "content/public/browser/web_contents.h" |
29 #include "content/test/test_browser_thread.h" | 29 #include "content/test/test_browser_thread.h" |
30 #include "net/url_request/url_request_filter.h" | 30 #include "net/url_request/url_request_filter.h" |
31 #include "net/url_request/url_request_test_job.h" | 31 #include "net/url_request/url_request_test_job.h" |
32 #include "net/url_request/url_request_test_util.h" | 32 #include "net/url_request/url_request_test_util.h" |
33 | 33 |
34 using content::BrowserThread; | 34 using content::BrowserThread; |
35 | 35 |
36 namespace { | 36 namespace { |
37 | 37 |
38 class TestData { | 38 class TestData { |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 // 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 |
260 // can be enabled for Chromium OS. | 260 // can be enabled for Chromium OS. |
261 IN_PROC_BROWSER_TEST_F(PrintDialogCloudTest, DISABLED_DialogGrabbed) { | 261 IN_PROC_BROWSER_TEST_F(PrintDialogCloudTest, DISABLED_DialogGrabbed) { |
262 BrowserList::SetLastActive(browser()); | 262 BrowserList::SetLastActive(browser()); |
263 ASSERT_TRUE(BrowserList::GetLastActive()); | 263 ASSERT_TRUE(BrowserList::GetLastActive()); |
264 | 264 |
265 AddTestHandlers(); | 265 AddTestHandlers(); |
266 | 266 |
267 // 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 |
268 // sure 'window.print()' gets to the right place. | 268 // sure 'window.print()' gets to the right place. |
269 ASSERT_TRUE(browser()->GetSelectedTabContents()); | 269 ASSERT_TRUE(browser()->GetSelectedWebContents()); |
270 ASSERT_TRUE(browser()->GetSelectedTabContents()->GetRenderViewHost()); | 270 ASSERT_TRUE(browser()->GetSelectedWebContents()->GetRenderViewHost()); |
271 | 271 |
272 string16 window_print = ASCIIToUTF16("window.print()"); | 272 string16 window_print = ASCIIToUTF16("window.print()"); |
273 browser()->GetSelectedTabContents()->GetRenderViewHost()-> | 273 browser()->GetSelectedWebContents()->GetRenderViewHost()-> |
274 ExecuteJavascriptInWebFrame(string16(), window_print); | 274 ExecuteJavascriptInWebFrame(string16(), window_print); |
275 | 275 |
276 ui_test_utils::RunMessageLoop(); | 276 ui_test_utils::RunMessageLoop(); |
277 | 277 |
278 ASSERT_TRUE(TestController::GetInstance()->result()); | 278 ASSERT_TRUE(TestController::GetInstance()->result()); |
279 } | 279 } |
280 #endif | 280 #endif |
OLD | NEW |