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 "chrome/service/cloud_print/cloud_print_url_fetcher.h" | 5 #include "chrome/service/cloud_print/cloud_print_url_fetcher.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
12 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
14 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "chrome/service/service_process.h" | 16 #include "chrome/service/service_process.h" |
17 #include "net/test/embedded_test_server/embedded_test_server.h" | 17 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 18 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" |
18 #include "net/url_request/url_request_context_getter.h" | 19 #include "net/url_request/url_request_context_getter.h" |
19 #include "net/url_request/url_request_status.h" | 20 #include "net/url_request/url_request_status.h" |
20 #include "net/url_request/url_request_test_util.h" | 21 #include "net/url_request/url_request_test_util.h" |
21 #include "net/url_request/url_request_throttler_manager.h" | 22 #include "net/url_request/url_request_throttler_manager.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
23 #include "url/gurl.h" | 24 #include "url/gurl.h" |
24 | 25 |
25 using base::Time; | 26 using base::Time; |
26 using base::TimeDelta; | 27 using base::TimeDelta; |
27 | 28 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 private: | 60 private: |
60 // Not owned here. | 61 // Not owned here. |
61 net::URLRequestThrottlerManager* throttler_manager_; | 62 net::URLRequestThrottlerManager* throttler_manager_; |
62 std::unique_ptr<net::TestURLRequestContext> context_; | 63 std::unique_ptr<net::TestURLRequestContext> context_; |
63 }; | 64 }; |
64 | 65 |
65 class TestCloudPrintURLFetcher : public CloudPrintURLFetcher { | 66 class TestCloudPrintURLFetcher : public CloudPrintURLFetcher { |
66 public: | 67 public: |
67 explicit TestCloudPrintURLFetcher( | 68 explicit TestCloudPrintURLFetcher( |
68 base::SingleThreadTaskRunner* io_task_runner) | 69 base::SingleThreadTaskRunner* io_task_runner) |
69 : io_task_runner_(io_task_runner) {} | 70 : CloudPrintURLFetcher(PARTIAL_TRAFFIC_ANNOTATION_FOR_TESTS), |
| 71 io_task_runner_(io_task_runner) {} |
70 | 72 |
71 net::URLRequestContextGetter* GetRequestContextGetter() override { | 73 net::URLRequestContextGetter* GetRequestContextGetter() override { |
72 return new TrackingTestURLRequestContextGetter(io_task_runner_.get(), | 74 return new TrackingTestURLRequestContextGetter(io_task_runner_.get(), |
73 throttler_manager()); | 75 throttler_manager()); |
74 } | 76 } |
75 | 77 |
76 net::URLRequestThrottlerManager* throttler_manager() { | 78 net::URLRequestThrottlerManager* throttler_manager() { |
77 return &throttler_manager_; | 79 return &throttler_manager_; |
78 } | 80 } |
79 | 81 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 test_server.AddDefaultHandlers(base::FilePath(kDocRoot)); | 367 test_server.AddDefaultHandlers(base::FilePath(kDocRoot)); |
366 ASSERT_TRUE(test_server.Start()); | 368 ASSERT_TRUE(test_server.Start()); |
367 | 369 |
368 GURL url(test_server.GetURL("/defaultresponse")); | 370 GURL url(test_server.GetURL("/defaultresponse")); |
369 CreateFetcher(url, 11); | 371 CreateFetcher(url, 11); |
370 | 372 |
371 base::RunLoop().Run(); | 373 base::RunLoop().Run(); |
372 } | 374 } |
373 | 375 |
374 } // namespace cloud_print | 376 } // namespace cloud_print |
OLD | NEW |