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

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

Issue 939503004: Add LoadState reporting to the mojo proxy resolver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@proxy-resolver-mojo
Patch Set: rebase Created 5 years, 9 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
« no previous file with comments | « net/proxy/mojo_proxy_resolver_factory_impl.cc ('k') | net/proxy/mojo_proxy_resolver_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/mojo_proxy_resolver_factory_impl.h" 5 #include "net/proxy/mojo_proxy_resolver_factory_impl.h"
6 6
7 #include "net/proxy/mock_proxy_resolver.h" 7 #include "net/proxy/mock_proxy_resolver.h"
8 #include "net/test/event_waiter.h" 8 #include "net/test/event_waiter.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" 10 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
(...skipping 28 matching lines...) Expand all
39 void SetUp() override { 39 void SetUp() override {
40 new MojoProxyResolverFactoryImpl( 40 new MojoProxyResolverFactoryImpl(
41 base::Bind(&MojoProxyResolverFactoryImplTest::CreateFakeProxyResolver, 41 base::Bind(&MojoProxyResolverFactoryImplTest::CreateFakeProxyResolver,
42 base::Unretained(this)), 42 base::Unretained(this)),
43 mojo::GetProxy(&factory_)); 43 mojo::GetProxy(&factory_));
44 } 44 }
45 45
46 void OnConnectionError() override { waiter_.NotifyEvent(CONNECTION_ERROR); } 46 void OnConnectionError() override { waiter_.NotifyEvent(CONNECTION_ERROR); }
47 47
48 scoped_ptr<ProxyResolver> CreateFakeProxyResolver( 48 scoped_ptr<ProxyResolver> CreateFakeProxyResolver(
49 HostResolver* host_resolver) { 49 HostResolver* host_resolver,
50 const ProxyResolver::LoadStateChangedCallback& callback) {
50 EXPECT_TRUE(host_resolver); 51 EXPECT_TRUE(host_resolver);
51 instances_created_++; 52 instances_created_++;
52 waiter_.NotifyEvent(RESOLVER_CREATED); 53 waiter_.NotifyEvent(RESOLVER_CREATED);
53 return make_scoped_ptr(new FakeProxyResolver(base::Bind( 54 return make_scoped_ptr(new FakeProxyResolver(base::Bind(
54 &MojoProxyResolverFactoryImplTest::OnFakeProxyInstanceDestroyed, 55 &MojoProxyResolverFactoryImplTest::OnFakeProxyInstanceDestroyed,
55 base::Unretained(this)))); 56 base::Unretained(this))));
56 } 57 }
57 58
58 void OnFakeProxyInstanceDestroyed() { 59 void OnFakeProxyInstanceDestroyed() {
59 instances_destroyed_++; 60 instances_destroyed_++;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 EXPECT_EQ(1, instances_created_); 115 EXPECT_EQ(1, instances_created_);
115 EXPECT_EQ(0, instances_destroyed_); 116 EXPECT_EQ(0, instances_destroyed_);
116 proxy_resolver.reset(); 117 proxy_resolver.reset();
117 host_resolver_request = mojo::InterfaceRequest<interfaces::HostResolver>(); 118 host_resolver_request = mojo::InterfaceRequest<interfaces::HostResolver>();
118 waiter_.WaitForEvent(RESOLVER_DESTROYED); 119 waiter_.WaitForEvent(RESOLVER_DESTROYED);
119 EXPECT_EQ(1, instances_created_); 120 EXPECT_EQ(1, instances_created_);
120 EXPECT_EQ(1, instances_destroyed_); 121 EXPECT_EQ(1, instances_destroyed_);
121 } 122 }
122 123
123 } // namespace net 124 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/mojo_proxy_resolver_factory_impl.cc ('k') | net/proxy/mojo_proxy_resolver_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698