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" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 SdchDictionaryFetcherTest() { | 88 SdchDictionaryFetcherTest() { |
89 URLRequestSpecifiedResponseJob::AddUrlHandler(); | 89 URLRequestSpecifiedResponseJob::AddUrlHandler(); |
90 context_.reset(new TestURLRequestContext); | 90 context_.reset(new TestURLRequestContext); |
91 fetcher_.reset(new SdchDictionaryFetcher( | 91 fetcher_.reset(new SdchDictionaryFetcher( |
92 context_.get(), | 92 context_.get(), |
93 base::Bind(&SdchDictionaryFetcherTest::OnDictionaryFetched, | 93 base::Bind(&SdchDictionaryFetcherTest::OnDictionaryFetched, |
94 base::Unretained(this)))); | 94 base::Unretained(this)))); |
95 } | 95 } |
96 | 96 |
97 ~SdchDictionaryFetcherTest() { | 97 ~SdchDictionaryFetcherTest() override { |
98 URLRequestSpecifiedResponseJob::RemoveUrlHandler(); | 98 URLRequestSpecifiedResponseJob::RemoveUrlHandler(); |
99 } | 99 } |
100 | 100 |
101 void OnDictionaryFetched(const std::string& dictionary_text, | 101 void OnDictionaryFetched(const std::string& dictionary_text, |
102 const GURL& dictionary_url, | 102 const GURL& dictionary_url, |
103 const BoundNetLog& net_log) { | 103 const BoundNetLog& net_log) { |
104 dictionary_additions.push_back( | 104 dictionary_additions.push_back( |
105 DictionaryAdditions(dictionary_text, dictionary_url)); | 105 DictionaryAdditions(dictionary_text, dictionary_url)); |
106 } | 106 } |
107 | 107 |
(...skipping 64 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 |