Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: chrome/browser/printing/print_preview_pdf_generated_browsertest.cc

Issue 1143343005: chrome/browser: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <algorithm> 5 #include <algorithm>
6 #include <fstream> 6 #include <fstream>
7 #include <iostream> 7 #include <iostream>
8 #include <iterator> 8 #include <iterator>
9 #include <limits> 9 #include <limits>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/callback.h" 15 #include "base/callback.h"
16 #include "base/files/file.h" 16 #include "base/files/file.h"
17 #include "base/files/file_path.h" 17 #include "base/files/file_path.h"
18 #include "base/files/file_util.h" 18 #include "base/files/file_util.h"
19 #include "base/files/scoped_temp_dir.h" 19 #include "base/files/scoped_temp_dir.h"
20 #include "base/location.h"
20 #include "base/logging.h" 21 #include "base/logging.h"
21 #include "base/md5.h" 22 #include "base/md5.h"
22 #include "base/memory/scoped_ptr.h" 23 #include "base/memory/scoped_ptr.h"
23 #include "base/path_service.h" 24 #include "base/path_service.h"
24 #include "base/run_loop.h" 25 #include "base/run_loop.h"
26 #include "base/single_thread_task_runner.h"
25 #include "base/strings/string_split.h" 27 #include "base/strings/string_split.h"
26 #include "base/strings/utf_string_conversions.h" 28 #include "base/strings/utf_string_conversions.h"
29 #include "base/thread_task_runner_handle.h"
27 #include "chrome/browser/printing/print_preview_dialog_controller.h" 30 #include "chrome/browser/printing/print_preview_dialog_controller.h"
28 #include "chrome/browser/ui/browser.h" 31 #include "chrome/browser/ui/browser.h"
29 #include "chrome/browser/ui/browser_commands.h" 32 #include "chrome/browser/ui/browser_commands.h"
30 #include "chrome/browser/ui/tabs/tab_strip_model.h" 33 #include "chrome/browser/ui/tabs/tab_strip_model.h"
31 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h" 34 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h"
32 #include "chrome/common/chrome_paths.h" 35 #include "chrome/common/chrome_paths.h"
33 #include "chrome/test/base/in_process_browser_test.h" 36 #include "chrome/test/base/in_process_browser_test.h"
34 #include "chrome/test/base/ui_test_utils.h" 37 #include "chrome/test/base/ui_test_utils.h"
35 #include "components/printing/common/print_messages.h" 38 #include "components/printing/common/print_messages.h"
36 #include "content/public/browser/web_contents.h" 39 #include "content/public/browser/web_contents.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 123
121 ~PrintPreviewObserver() override {} 124 ~PrintPreviewObserver() override {}
122 125
123 // Sets closure for the observer so that it can end the loop. 126 // Sets closure for the observer so that it can end the loop.
124 void set_quit_closure(const base::Closure &closure) { 127 void set_quit_closure(const base::Closure &closure) {
125 quit_closure_ = closure; 128 quit_closure_ = closure;
126 } 129 }
127 130
128 // Actually stops the message loop so that the test can proceed. 131 // Actually stops the message loop so that the test can proceed.
129 void EndLoop() { 132 void EndLoop() {
130 base::MessageLoop::current()->PostTask(FROM_HERE, quit_closure_); 133 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, quit_closure_);
131 } 134 }
132 135
133 bool OnMessageReceived(const IPC::Message& message) override { 136 bool OnMessageReceived(const IPC::Message& message) override {
134 IPC_BEGIN_MESSAGE_MAP(PrintPreviewObserver, message) 137 IPC_BEGIN_MESSAGE_MAP(PrintPreviewObserver, message)
135 IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPreviewPageCount, 138 IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPreviewPageCount,
136 OnDidGetPreviewPageCount) 139 OnDidGetPreviewPageCount)
137 IPC_END_MESSAGE_MAP(); 140 IPC_END_MESSAGE_MAP();
138 return false; 141 return false;
139 } 142 }
140 143
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 // waiting for this message and start waiting for the image data. 633 // waiting for this message and start waiting for the image data.
631 std::cout << "#EOF\n"; 634 std::cout << "#EOF\n";
632 std::cout.flush(); 635 std::cout.flush();
633 636
634 SendPng(); 637 SendPng();
635 Reset(); 638 Reset();
636 } 639 }
637 } 640 }
638 641
639 } // namespace printing 642 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698