| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/sdch_dictionary_fetcher.h" | 5 #include "net/url_request/sdch_dictionary_fetcher.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
| 13 #include "net/base/sdch_manager.h" | 13 #include "net/base/sdch_manager.h" |
| 14 #include "net/url_request/url_request_data_job.h" | 14 #include "net/url_request/url_request_data_job.h" |
| 15 #include "net/url_request/url_request_filter.h" | 15 #include "net/url_request/url_request_filter.h" |
| 16 #include "net/url_request/url_request_interceptor.h" | 16 #include "net/url_request/url_request_interceptor.h" |
| 17 #include "net/url_request/url_request_test_util.h" | 17 #include "net/url_request/url_request_test_util.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 20 | 20 |
| 21 namespace net { | 21 namespace net { |
| 22 | 22 |
| 23 static const char* kSampleBufferContext = "This is a sample buffer."; | 23 static const char kSampleBufferContext[] = "This is a sample buffer."; |
| 24 static const char* kTestDomain = "top.domain.test"; | 24 static const char kTestDomain[] = "top.domain.test"; |
| 25 | 25 |
| 26 class URLRequestSpecifiedResponseJob : public URLRequestSimpleJob { | 26 class URLRequestSpecifiedResponseJob : public URLRequestSimpleJob { |
| 27 public: | 27 public: |
| 28 URLRequestSpecifiedResponseJob(URLRequest* request, | 28 URLRequestSpecifiedResponseJob(URLRequest* request, |
| 29 NetworkDelegate* network_delegate) | 29 NetworkDelegate* network_delegate) |
| 30 : URLRequestSimpleJob(request, network_delegate) {} | 30 : URLRequestSimpleJob(request, network_delegate) {} |
| 31 | 31 |
| 32 static void AddUrlHandler() { | 32 static void AddUrlHandler() { |
| 33 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); | 33 net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); |
| 34 jobs_requested_ = 0; | 34 jobs_requested_ = 0; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 fetcher()->Schedule(dictionary_url_1); | 172 fetcher()->Schedule(dictionary_url_1); |
| 173 fetcher()->Schedule(dictionary_url_2); | 173 fetcher()->Schedule(dictionary_url_2); |
| 174 fetcher()->Schedule(dictionary_url_3); | 174 fetcher()->Schedule(dictionary_url_3); |
| 175 fetcher()->Cancel(); | 175 fetcher()->Cancel(); |
| 176 base::RunLoop().RunUntilIdle(); | 176 base::RunLoop().RunUntilIdle(); |
| 177 | 177 |
| 178 // Synchronous execution may have resulted in a single job being scheduled. | 178 // Synchronous execution may have resulted in a single job being scheduled. |
| 179 EXPECT_GE(1, JobsRequested()); | 179 EXPECT_GE(1, JobsRequested()); |
| 180 } | 180 } |
| 181 } | 181 } |
| OLD | NEW |