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

Side by Side Diff: net/proxy/proxy_resolver_v8_tracing_wrapper_unittest.cc

Issue 2090613002: Remove calls to deprecated MessageLoop methods in net. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "net/proxy/proxy_resolver_v8_tracing_wrapper.h" 5 #include "net/proxy/proxy_resolver_v8_tracing_wrapper.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/run_loop.h"
13 #include "base/stl_util.h" 14 #include "base/stl_util.h"
14 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
15 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
16 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
17 #include "base/synchronization/waitable_event.h" 18 #include "base/synchronization/waitable_event.h"
18 #include "base/threading/platform_thread.h" 19 #include "base/threading/platform_thread.h"
19 #include "base/values.h" 20 #include "base/values.h"
20 #include "net/base/net_errors.h" 21 #include "net/base/net_errors.h"
21 #include "net/base/test_completion_callback.h" 22 #include "net/base/test_completion_callback.h"
22 #include "net/dns/host_cache.h" 23 #include "net/dns/host_cache.h"
(...skipping 11 matching lines...) Expand all
34 namespace net { 35 namespace net {
35 36
36 namespace { 37 namespace {
37 38
38 class ProxyResolverV8TracingWrapperTest : public testing::Test { 39 class ProxyResolverV8TracingWrapperTest : public testing::Test {
39 public: 40 public:
40 void TearDown() override { 41 void TearDown() override {
41 // Drain any pending messages, which may be left over from cancellation. 42 // Drain any pending messages, which may be left over from cancellation.
42 // This way they get reliably run as part of the current test, rather than 43 // This way they get reliably run as part of the current test, rather than
43 // spilling into the next test's execution. 44 // spilling into the next test's execution.
44 base::MessageLoop::current()->RunUntilIdle(); 45 base::RunLoop().RunUntilIdle();
45 } 46 }
46 }; 47 };
47 48
48 scoped_refptr<ProxyResolverScriptData> LoadScriptData(const char* filename) { 49 scoped_refptr<ProxyResolverScriptData> LoadScriptData(const char* filename) {
49 base::FilePath path; 50 base::FilePath path;
50 PathService::Get(base::DIR_SOURCE_ROOT, &path); 51 PathService::Get(base::DIR_SOURCE_ROOT, &path);
51 path = path.AppendASCII("net"); 52 path = path.AppendASCII("net");
52 path = path.AppendASCII("data"); 53 path = path.AppendASCII("data");
53 path = path.AppendASCII("proxy_resolver_v8_tracing_unittest"); 54 path = path.AppendASCII("proxy_resolver_v8_tracing_unittest");
54 path = path.AppendASCII(filename); 55 path = path.AppendASCII(filename);
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 void CancelRequest(RequestHandle req) override { 798 void CancelRequest(RequestHandle req) override {
798 EXPECT_EQ(reinterpret_cast<RequestHandle*>(1), req); 799 EXPECT_EQ(reinterpret_cast<RequestHandle*>(1), req);
799 num_cancelled_requests_++; 800 num_cancelled_requests_++;
800 } 801 }
801 802
802 void SetAction(const base::Callback<void(void)>& action) { action_ = action; } 803 void SetAction(const base::Callback<void(void)>& action) { action_ = action; }
803 804
804 // Waits until Resolve() has been called. 805 // Waits until Resolve() has been called.
805 void WaitUntilRequestIsReceived() { 806 void WaitUntilRequestIsReceived() {
806 waiting_for_resolve_ = true; 807 waiting_for_resolve_ = true;
807 base::MessageLoop::current()->Run(); 808 base::RunLoop().Run();
808 DCHECK(waiting_for_resolve_); 809 DCHECK(waiting_for_resolve_);
809 waiting_for_resolve_ = false; 810 waiting_for_resolve_ = false;
810 } 811 }
811 812
812 int num_cancelled_requests() const { return num_cancelled_requests_; } 813 int num_cancelled_requests() const { return num_cancelled_requests_; }
813 814
814 private: 815 private:
815 int num_cancelled_requests_; 816 int num_cancelled_requests_;
816 bool waiting_for_resolve_; 817 bool waiting_for_resolve_;
817 base::Callback<void(void)> action_; 818 base::Callback<void(void)> action_;
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 proxy_uri.substr(0, proxy_uri.find(':') + 1)); 1127 proxy_uri.substr(0, proxy_uri.find(':') + 1));
1127 } else { 1128 } else {
1128 NOTREACHED(); 1129 NOTREACHED();
1129 } 1130 }
1130 } 1131 }
1131 } 1132 }
1132 1133
1133 } // namespace 1134 } // namespace
1134 1135
1135 } // namespace net 1136 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_resolver_v8_tracing_unittest.cc ('k') | net/socket/client_socket_pool_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698