| 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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/process/process.h" | 11 #include "base/process/process_handle.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/test/test_file_util.h" | 14 #include "base/test/test_file_util.h" |
| 15 #include "base/threading/simple_thread.h" | 15 #include "base/threading/simple_thread.h" |
| 16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 17 #include "chrome/browser/printing/print_job.h" | 17 #include "chrome/browser/printing/print_job.h" |
| 18 #include "chrome/browser/printing/print_view_manager.h" | 18 #include "chrome/browser/printing/print_view_manager.h" |
| 19 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
| 20 #include "chrome/browser/ui/browser_commands.h" | 20 #include "chrome/browser/ui/browser_commands.h" |
| 21 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 21 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 print_button_id, | 289 print_button_id, |
| 290 reinterpret_cast<LPARAM>(GetDlgItem(dialog_window, print_button_id))); | 290 reinterpret_cast<LPARAM>(GetDlgItem(dialog_window, print_button_id))); |
| 291 return res == 0; | 291 return res == 0; |
| 292 } | 292 } |
| 293 | 293 |
| 294 // Dismiss the first dialog box owned by owner_process by "executing" the | 294 // Dismiss the first dialog box owned by owner_process by "executing" the |
| 295 // default button. | 295 // default button. |
| 296 class DismissTheWindow : public base::DelegateSimpleThread::Delegate { | 296 class DismissTheWindow : public base::DelegateSimpleThread::Delegate { |
| 297 public: | 297 public: |
| 298 DismissTheWindow() | 298 DismissTheWindow() |
| 299 : owner_process_(base::Process::Current().pid()) { | 299 : owner_process_(base::GetCurrentProcId()) { |
| 300 } | 300 } |
| 301 | 301 |
| 302 virtual void Run() { | 302 virtual void Run() { |
| 303 HWND dialog_window; | 303 HWND dialog_window; |
| 304 for (;;) { | 304 for (;;) { |
| 305 // First enumerate the windows. | 305 // First enumerate the windows. |
| 306 dialog_window = FindDialogWindow(owner_process_); | 306 dialog_window = FindDialogWindow(owner_process_); |
| 307 | 307 |
| 308 // Try to close it. | 308 // Try to close it. |
| 309 if (dialog_window) { | 309 if (dialog_window) { |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 | 460 |
| 461 // Force a navigation elsewhere to verify that it's fine with it. | 461 // Force a navigation elsewhere to verify that it's fine with it. |
| 462 url = test_server()->GetURL("files/printing/test1.html"); | 462 url = test_server()->GetURL("files/printing/test1.html"); |
| 463 ui_test_utils::NavigateToURL(browser(), url); | 463 ui_test_utils::NavigateToURL(browser(), url); |
| 464 } | 464 } |
| 465 chrome::CloseWindow(browser()); | 465 chrome::CloseWindow(browser()); |
| 466 content::RunAllPendingInMessageLoop(); | 466 content::RunAllPendingInMessageLoop(); |
| 467 | 467 |
| 468 EXPECT_EQ(0., CompareWithResult(L"iframe")) << L"iframe"; | 468 EXPECT_EQ(0., CompareWithResult(L"iframe")) << L"iframe"; |
| 469 } | 469 } |
| OLD | NEW |