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/thread_task_runner_handle.h" |
7 #include "build/build_config.h" | 8 #include "build/build_config.h" |
8 #include "net/test/test_server.h" | 9 #include "net/test/test_server.h" |
9 #include "net/url_request/url_request.h" | 10 #include "net/url_request/url_request.h" |
10 #include "net/url_request/url_request_test_util.h" | 11 #include "net/url_request/url_request_test_util.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "testing/platform_test.h" | 13 #include "testing/platform_test.h" |
13 | 14 |
14 #if defined(OS_LINUX) | 15 #if defined(OS_LINUX) |
15 #include "net/proxy/proxy_config.h" | 16 #include "net/proxy/proxy_config.h" |
16 #include "net/proxy/proxy_config_service_fixed.h" | 17 #include "net/proxy/proxy_config_service_fixed.h" |
(...skipping 17 matching lines...) Expand all Loading... |
34 ScopedCustomUrlRequestTestHttpHost::value(), | 35 ScopedCustomUrlRequestTestHttpHost::value(), |
35 FilePath()) {} | 36 FilePath()) {} |
36 }; | 37 }; |
37 | 38 |
38 class URLRequestContextBuilderTest : public PlatformTest { | 39 class URLRequestContextBuilderTest : public PlatformTest { |
39 protected: | 40 protected: |
40 URLRequestContextBuilderTest() | 41 URLRequestContextBuilderTest() |
41 : test_server_( | 42 : test_server_( |
42 FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))) { | 43 FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))) { |
43 #if defined(OS_LINUX) | 44 #if defined(OS_LINUX) |
44 builder_.set_proxy_config_service( | 45 builder_.set_glib_task_runner(base::ThreadTaskRunnerHandle::Get()); |
45 new ProxyConfigServiceFixed(ProxyConfig::CreateDirect())); | |
46 #endif // defined(OS_LINUX) | 46 #endif // defined(OS_LINUX) |
47 } | 47 } |
48 | 48 |
49 LocalHttpTestServer test_server_; | 49 LocalHttpTestServer test_server_; |
50 URLRequestContextBuilder builder_; | 50 URLRequestContextBuilder builder_; |
51 }; | 51 }; |
52 | 52 |
53 TEST_F(URLRequestContextBuilderTest, DefaultSettings) { | 53 TEST_F(URLRequestContextBuilderTest, DefaultSettings) { |
54 ASSERT_TRUE(test_server_.Start()); | 54 ASSERT_TRUE(test_server_.Start()); |
55 | 55 |
(...skipping 18 matching lines...) Expand all Loading... |
74 test_server_.GetURL("echoheader?User-Agent"), &delegate, context.get()); | 74 test_server_.GetURL("echoheader?User-Agent"), &delegate, context.get()); |
75 request.set_method("GET"); | 75 request.set_method("GET"); |
76 request.Start(); | 76 request.Start(); |
77 MessageLoop::current()->Run(); | 77 MessageLoop::current()->Run(); |
78 EXPECT_EQ("Bar", delegate.data_received()); | 78 EXPECT_EQ("Bar", delegate.data_received()); |
79 } | 79 } |
80 | 80 |
81 } // namespace | 81 } // namespace |
82 | 82 |
83 } // namespace net | 83 } // namespace net |
OLD | NEW |