OLD | NEW |
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 "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "net/base/test_completion_callback.h" | 8 #include "net/base/test_completion_callback.h" |
9 #include "net/proxy/mock_proxy_resolver.h" | 9 #include "net/proxy/mock_proxy_resolver.h" |
10 #include "net/proxy/proxy_resolver_error_observer.h" | 10 #include "net/proxy/proxy_resolver_error_observer.h" |
11 #include "net/test/event_waiter.h" | 11 #include "net/test/event_waiter.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" | 13 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" |
14 #include "third_party/mojo/src/mojo/public/cpp/bindings/error_handler.h" | 14 #include "third_party/mojo/src/mojo/public/cpp/bindings/error_handler.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 namespace { | 17 namespace { |
18 | 18 |
19 const char kScriptData[] = "FooBarBaz"; | 19 const char kScriptData[] = "FooBarBaz"; |
20 | 20 |
21 class FakeProxyResolver : public MockAsyncProxyResolverExpectsBytes { | 21 class FakeProxyResolver : public MockAsyncProxyResolver { |
22 public: | 22 public: |
23 explicit FakeProxyResolver(const base::Closure& on_destruction) | 23 explicit FakeProxyResolver(const base::Closure& on_destruction) |
24 : on_destruction_(on_destruction) {} | 24 : on_destruction_(on_destruction) {} |
25 | 25 |
26 ~FakeProxyResolver() override { on_destruction_.Run(); } | 26 ~FakeProxyResolver() override { on_destruction_.Run(); } |
27 | 27 |
28 private: | 28 private: |
29 const base::Closure on_destruction_; | 29 const base::Closure on_destruction_; |
30 }; | 30 }; |
31 | 31 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 waiter_.WaitForEvent(RESOLVER_CREATED); | 298 waiter_.WaitForEvent(RESOLVER_CREATED); |
299 EXPECT_EQ(0, instances_destroyed_); | 299 EXPECT_EQ(0, instances_destroyed_); |
300 ASSERT_EQ(1u, mock_factory_->pending_requests().size()); | 300 ASSERT_EQ(1u, mock_factory_->pending_requests().size()); |
301 EXPECT_EQ(base::ASCIIToUTF16(kScriptData), | 301 EXPECT_EQ(base::ASCIIToUTF16(kScriptData), |
302 mock_factory_->pending_requests()[0]->script_data()->utf16()); | 302 mock_factory_->pending_requests()[0]->script_data()->utf16()); |
303 factory_.reset(); | 303 factory_.reset(); |
304 waiter_.WaitForEvent(CONNECTION_ERROR); | 304 waiter_.WaitForEvent(CONNECTION_ERROR); |
305 } | 305 } |
306 | 306 |
307 } // namespace net | 307 } // namespace net |
OLD | NEW |