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

Side by Side Diff: chrome/browser/printing/cloud_print/privet_http_unittest.cc

Issue 2033753002: Remove use of deprecated MessageLoop methods in chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: manual change Created 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/cloud_print/privet_http.h" 5 #include "chrome/browser/printing/cloud_print/privet_http.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
11 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
12 #include "base/location.h"
12 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
13 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/single_thread_task_runner.h"
16 #include "base/threading/thread_task_runner_handle.h"
14 #include "chrome/browser/printing/cloud_print/privet_http_impl.h" 17 #include "chrome/browser/printing/cloud_print/privet_http_impl.h"
15 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
16 #include "content/public/test/test_browser_thread_bundle.h" 19 #include "content/public/test/test_browser_thread_bundle.h"
17 #include "net/test/embedded_test_server/embedded_test_server.h" 20 #include "net/test/embedded_test_server/embedded_test_server.h"
18 #include "net/url_request/test_url_fetcher_factory.h" 21 #include "net/url_request/test_url_fetcher_factory.h"
19 #include "net/url_request/url_request_test_util.h" 22 #include "net/url_request/url_request_test_util.h"
20 #include "testing/gmock/include/gmock/gmock.h" 23 #include "testing/gmock/include/gmock/gmock.h"
21 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
22 25
23 #if defined(ENABLE_PRINT_PREVIEW) 26 #if defined(ENABLE_PRINT_PREVIEW)
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 const PrivetURLFetcher::TokenCallback& callback) override { 1058 const PrivetURLFetcher::TokenCallback& callback) override {
1056 callback.Run("abc"); 1059 callback.Run("abc");
1057 } 1060 }
1058 1061
1059 void OnError(PrivetURLFetcher* fetcher, 1062 void OnError(PrivetURLFetcher* fetcher,
1060 PrivetURLFetcher::ErrorType error) override { 1063 PrivetURLFetcher::ErrorType error) override {
1061 done_ = true; 1064 done_ = true;
1062 success_ = false; 1065 success_ = false;
1063 error_ = error; 1066 error_ = error;
1064 1067
1065 base::MessageLoop::current()->PostTask(FROM_HERE, quit_); 1068 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, quit_);
1066 } 1069 }
1067 1070
1068 void OnParsedJson(PrivetURLFetcher* fetcher, 1071 void OnParsedJson(PrivetURLFetcher* fetcher,
1069 const base::DictionaryValue& value, 1072 const base::DictionaryValue& value,
1070 bool has_error) override { 1073 bool has_error) override {
1071 NOTREACHED(); 1074 NOTREACHED();
1072 base::MessageLoop::current()->PostTask(FROM_HERE, quit_); 1075 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, quit_);
1073 } 1076 }
1074 1077
1075 bool OnRawData(PrivetURLFetcher* fetcher, 1078 bool OnRawData(PrivetURLFetcher* fetcher,
1076 bool response_is_file, 1079 bool response_is_file,
1077 const std::string& data_string, 1080 const std::string& data_string,
1078 const base::FilePath& data_file) override { 1081 const base::FilePath& data_file) override {
1079 done_ = true; 1082 done_ = true;
1080 success_ = true; 1083 success_ = true;
1081 1084
1082 base::MessageLoop::current()->PostTask(FROM_HERE, quit_); 1085 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, quit_);
1083 return true; 1086 return true;
1084 } 1087 }
1085 1088
1086 bool Run() { 1089 bool Run() {
1087 success_ = false; 1090 success_ = false;
1088 done_ = false; 1091 done_ = false;
1089 1092
1090 base::RunLoop run_loop; 1093 base::RunLoop run_loop;
1091 quit_ = run_loop.QuitClosure(); 1094 quit_ = run_loop.QuitClosure();
1092 1095
(...skipping 20 matching lines...) Expand all
1113 base::Closure quit_; 1116 base::Closure quit_;
1114 }; 1117 };
1115 1118
1116 TEST_F(PrivetHttpWithServerTest, HttpServer) { 1119 TEST_F(PrivetHttpWithServerTest, HttpServer) {
1117 EXPECT_TRUE(Run()); 1120 EXPECT_TRUE(Run());
1118 } 1121 }
1119 1122
1120 } // namespace 1123 } // namespace
1121 1124
1122 } // namespace cloud_print 1125 } // namespace cloud_print
OLDNEW
« no previous file with comments | « chrome/browser/printing/background_printing_manager.cc ('k') | chrome/browser/printing/print_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698