OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/url_request/url_request_context_builder.h" | 5 #include "net/url_request/url_request_context_builder.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "net/base/request_priority.h" | 9 #include "net/base/request_priority.h" |
10 #include "net/http/http_auth_handler.h" | 10 #include "net/http/http_auth_handler.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 LocalHttpTestServer() | 36 LocalHttpTestServer() |
37 : SpawnedTestServer(SpawnedTestServer::TYPE_HTTP, | 37 : SpawnedTestServer(SpawnedTestServer::TYPE_HTTP, |
38 ScopedCustomUrlRequestTestHttpHost::value(), | 38 ScopedCustomUrlRequestTestHttpHost::value(), |
39 base::FilePath()) {} | 39 base::FilePath()) {} |
40 }; | 40 }; |
41 | 41 |
42 class MockHttpAuthHandlerFactory : public HttpAuthHandlerFactory { | 42 class MockHttpAuthHandlerFactory : public HttpAuthHandlerFactory { |
43 public: | 43 public: |
44 explicit MockHttpAuthHandlerFactory(int return_code) : | 44 explicit MockHttpAuthHandlerFactory(int return_code) : |
45 return_code_(return_code) {} | 45 return_code_(return_code) {} |
46 virtual ~MockHttpAuthHandlerFactory() {} | 46 ~MockHttpAuthHandlerFactory() override {} |
47 | 47 |
48 virtual int CreateAuthHandler(HttpAuthChallengeTokenizer* challenge, | 48 int CreateAuthHandler(HttpAuthChallengeTokenizer* challenge, |
49 HttpAuth::Target target, | 49 HttpAuth::Target target, |
50 const GURL& origin, | 50 const GURL& origin, |
51 CreateReason reason, | 51 CreateReason reason, |
52 int nonce_count, | 52 int nonce_count, |
53 const BoundNetLog& net_log, | 53 const BoundNetLog& net_log, |
54 scoped_ptr<HttpAuthHandler>* handler) override { | 54 scoped_ptr<HttpAuthHandler>* handler) override { |
55 handler->reset(); | 55 handler->reset(); |
56 return return_code_; | 56 return return_code_; |
57 } | 57 } |
58 | 58 |
59 private: | 59 private: |
60 int return_code_; | 60 int return_code_; |
61 }; | 61 }; |
62 | 62 |
63 class URLRequestContextBuilderTest : public PlatformTest { | 63 class URLRequestContextBuilderTest : public PlatformTest { |
64 protected: | 64 protected: |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 &handler)); | 127 &handler)); |
128 // Verify that a handler isn't returned for a bogus scheme. | 128 // Verify that a handler isn't returned for a bogus scheme. |
129 EXPECT_EQ(ERR_UNSUPPORTED_AUTH_SCHEME, | 129 EXPECT_EQ(ERR_UNSUPPORTED_AUTH_SCHEME, |
130 context->http_auth_handler_factory()->CreateAuthHandlerFromString( | 130 context->http_auth_handler_factory()->CreateAuthHandlerFromString( |
131 "Bogus", HttpAuth::AUTH_SERVER, gurl, BoundNetLog(), &handler)); | 131 "Bogus", HttpAuth::AUTH_SERVER, gurl, BoundNetLog(), &handler)); |
132 } | 132 } |
133 | 133 |
134 } // namespace | 134 } // namespace |
135 | 135 |
136 } // namespace net | 136 } // namespace net |
OLD | NEW |