| OLD | NEW |
| 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/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 ProxyResolverFactoryV8TracingWrapper factory( | 77 ProxyResolverFactoryV8TracingWrapper factory( |
| 78 host_resolver, net_log, | 78 host_resolver, net_log, |
| 79 base::Bind(&ReturnErrorObserver, base::Passed(&error_observer))); | 79 base::Bind(&ReturnErrorObserver, base::Passed(&error_observer))); |
| 80 TestCompletionCallback callback; | 80 TestCompletionCallback callback; |
| 81 scoped_ptr<ProxyResolverFactory::Request> request; | 81 scoped_ptr<ProxyResolverFactory::Request> request; |
| 82 int rv = factory.CreateProxyResolver(LoadScriptData(filename), &resolver, | 82 int rv = factory.CreateProxyResolver(LoadScriptData(filename), &resolver, |
| 83 callback.callback(), &request); | 83 callback.callback(), &request); |
| 84 EXPECT_EQ(ERR_IO_PENDING, rv); | 84 EXPECT_EQ(ERR_IO_PENDING, rv); |
| 85 EXPECT_EQ(OK, callback.WaitForResult()); | 85 EXPECT_EQ(OK, callback.WaitForResult()); |
| 86 EXPECT_TRUE(resolver); | 86 EXPECT_TRUE(resolver); |
| 87 return resolver.Pass(); | 87 return resolver; |
| 88 } | 88 } |
| 89 | 89 |
| 90 class MockErrorObserver : public ProxyResolverErrorObserver { | 90 class MockErrorObserver : public ProxyResolverErrorObserver { |
| 91 public: | 91 public: |
| 92 void OnPACScriptError(int line_number, const base::string16& error) override { | 92 void OnPACScriptError(int line_number, const base::string16& error) override { |
| 93 output += base::StringPrintf("Error: line %d: %s\n", line_number, | 93 output += base::StringPrintf("Error: line %d: %s\n", line_number, |
| 94 base::UTF16ToASCII(error).c_str()); | 94 base::UTF16ToASCII(error).c_str()); |
| 95 waiter_.NotifyEvent(EVENT_ERROR); | 95 waiter_.NotifyEvent(EVENT_ERROR); |
| 96 if (!error_callback_.is_null()) | 96 if (!error_callback_.is_null()) |
| 97 error_callback_.Run(); | 97 error_callback_.Run(); |
| (...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1125 proxy_uri.substr(0, proxy_uri.find(':') + 1)); | 1125 proxy_uri.substr(0, proxy_uri.find(':') + 1)); |
| 1126 } else { | 1126 } else { |
| 1127 NOTREACHED(); | 1127 NOTREACHED(); |
| 1128 } | 1128 } |
| 1129 } | 1129 } |
| 1130 } | 1130 } |
| 1131 | 1131 |
| 1132 } // namespace | 1132 } // namespace |
| 1133 | 1133 |
| 1134 } // namespace net | 1134 } // namespace net |
| OLD | NEW |