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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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() { |
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 dictionary_additions.push_back( | 104 dictionary_additions.push_back( |
104 DictionaryAdditions(dictionary_text, dictionary_url)); | 105 DictionaryAdditions(dictionary_text, dictionary_url)); |
105 } | 106 } |
106 | 107 |
107 void GetDictionaryAdditions(std::vector<DictionaryAdditions>* out) { | 108 void GetDictionaryAdditions(std::vector<DictionaryAdditions>* out) { |
108 out->swap(dictionary_additions); | 109 out->swap(dictionary_additions); |
109 dictionary_additions.clear(); | 110 dictionary_additions.clear(); |
110 } | 111 } |
111 | 112 |
112 SdchDictionaryFetcher* fetcher() { return fetcher_.get(); } | 113 SdchDictionaryFetcher* fetcher() { return fetcher_.get(); } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 fetcher()->Schedule(dictionary_url_1); | 172 fetcher()->Schedule(dictionary_url_1); |
172 fetcher()->Schedule(dictionary_url_2); | 173 fetcher()->Schedule(dictionary_url_2); |
173 fetcher()->Schedule(dictionary_url_3); | 174 fetcher()->Schedule(dictionary_url_3); |
174 fetcher()->Cancel(); | 175 fetcher()->Cancel(); |
175 base::RunLoop().RunUntilIdle(); | 176 base::RunLoop().RunUntilIdle(); |
176 | 177 |
177 // Synchronous execution may have resulted in a single job being scheduled. | 178 // Synchronous execution may have resulted in a single job being scheduled. |
178 EXPECT_GE(1, JobsRequested()); | 179 EXPECT_GE(1, JobsRequested()); |
179 } | 180 } |
180 } | 181 } |
OLD | NEW |