| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/files/file_enumerator.h" | 6 #include "base/files/file_enumerator.h" |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/location.h" |
| 9 #include "base/macros.h" | 10 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 11 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 12 #include "base/process/process_handle.h" | 13 #include "base/process/process_handle.h" |
| 14 #include "base/single_thread_task_runner.h" |
| 13 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/test/test_file_util.h" | 17 #include "base/test/test_file_util.h" |
| 16 #include "base/threading/simple_thread.h" | 18 #include "base/threading/simple_thread.h" |
| 19 #include "base/threading/thread_task_runner_handle.h" |
| 17 #include "chrome/browser/chrome_notification_types.h" | 20 #include "chrome/browser/chrome_notification_types.h" |
| 18 #include "chrome/browser/printing/print_job.h" | 21 #include "chrome/browser/printing/print_job.h" |
| 19 #include "chrome/browser/printing/print_view_manager.h" | 22 #include "chrome/browser/printing/print_view_manager.h" |
| 20 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
| 21 #include "chrome/browser/ui/browser_commands.h" | 24 #include "chrome/browser/ui/browser_commands.h" |
| 22 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 25 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 23 #include "chrome/common/chrome_paths.h" | 26 #include "chrome/common/chrome_paths.h" |
| 24 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
| 25 #include "chrome/test/base/in_process_browser_test.h" | 28 #include "chrome/test/base/in_process_browser_test.h" |
| 26 #include "chrome/test/base/ui_test_utils.h" | 29 #include "chrome/test/base/ui_test_utils.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 registrar_.RemoveAll(); | 76 registrar_.RemoveAll(); |
| 74 } | 77 } |
| 75 | 78 |
| 76 virtual void Observe(int type, | 79 virtual void Observe(int type, |
| 77 const content::NotificationSource& source, | 80 const content::NotificationSource& source, |
| 78 const content::NotificationDetails& details) { | 81 const content::NotificationDetails& details) { |
| 79 ASSERT_EQ(chrome::NOTIFICATION_PRINT_JOB_EVENT, type); | 82 ASSERT_EQ(chrome::NOTIFICATION_PRINT_JOB_EVENT, type); |
| 80 switch (content::Details<printing::JobEventDetails>(details)->type()) { | 83 switch (content::Details<printing::JobEventDetails>(details)->type()) { |
| 81 case printing::JobEventDetails::JOB_DONE: { | 84 case printing::JobEventDetails::JOB_DONE: { |
| 82 // Succeeded. | 85 // Succeeded. |
| 83 base::MessageLoop::current()->PostTask( | 86 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 84 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 87 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
| 85 break; | 88 break; |
| 86 } | 89 } |
| 87 case printing::JobEventDetails::USER_INIT_CANCELED: | 90 case printing::JobEventDetails::USER_INIT_CANCELED: |
| 88 case printing::JobEventDetails::FAILED: { | 91 case printing::JobEventDetails::FAILED: { |
| 89 // Failed. | 92 // Failed. |
| 90 ASSERT_TRUE(false); | 93 ASSERT_TRUE(false); |
| 91 base::MessageLoop::current()->PostTask( | 94 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 92 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 95 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
| 93 break; | 96 break; |
| 94 } | 97 } |
| 95 case printing::JobEventDetails::NEW_DOC: | 98 case printing::JobEventDetails::NEW_DOC: |
| 96 case printing::JobEventDetails::USER_INIT_DONE: | 99 case printing::JobEventDetails::USER_INIT_DONE: |
| 97 case printing::JobEventDetails::DEFAULT_INIT_DONE: | 100 case printing::JobEventDetails::DEFAULT_INIT_DONE: |
| 98 case printing::JobEventDetails::NEW_PAGE: | 101 case printing::JobEventDetails::NEW_PAGE: |
| 99 case printing::JobEventDetails::PAGE_DONE: | 102 case printing::JobEventDetails::PAGE_DONE: |
| 100 case printing::JobEventDetails::DOC_DONE: | 103 case printing::JobEventDetails::DOC_DONE: |
| 101 case printing::JobEventDetails::ALL_PAGES_REQUESTED: { | 104 case printing::JobEventDetails::ALL_PAGES_REQUESTED: { |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 | 466 |
| 464 // Force a navigation elsewhere to verify that it's fine with it. | 467 // Force a navigation elsewhere to verify that it's fine with it. |
| 465 url = embedded_test_server()->GetURL("/printing/test1.html"); | 468 url = embedded_test_server()->GetURL("/printing/test1.html"); |
| 466 ui_test_utils::NavigateToURL(browser(), url); | 469 ui_test_utils::NavigateToURL(browser(), url); |
| 467 } | 470 } |
| 468 chrome::CloseWindow(browser()); | 471 chrome::CloseWindow(browser()); |
| 469 content::RunAllPendingInMessageLoop(); | 472 content::RunAllPendingInMessageLoop(); |
| 470 | 473 |
| 471 EXPECT_EQ(0., CompareWithResult(L"iframe")) << L"iframe"; | 474 EXPECT_EQ(0., CompareWithResult(L"iframe")) << L"iframe"; |
| 472 } | 475 } |
| OLD | NEW |