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 <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 base::Bind(&SdchDictionaryFetcherTest::OnNumberJobsChanged, | 278 base::Bind(&SdchDictionaryFetcherTest::OnNumberJobsChanged, |
279 factory_.GetWeakPtr())); | 279 factory_.GetWeakPtr())); |
280 } | 280 } |
281 | 281 |
282 ~SdchDictionaryFetcherTest() override { | 282 ~SdchDictionaryFetcherTest() override { |
283 SDCHTestRequestInterceptor::Unregister(); | 283 SDCHTestRequestInterceptor::Unregister(); |
284 } | 284 } |
285 | 285 |
286 void OnDictionaryFetched(const std::string& dictionary_text, | 286 void OnDictionaryFetched(const std::string& dictionary_text, |
287 const GURL& dictionary_url, | 287 const GURL& dictionary_url, |
288 const BoundNetLog& net_log, | 288 const NetLogWithSource& net_log, |
289 bool was_from_cache) { | 289 bool was_from_cache) { |
290 dictionary_additions_.push_back( | 290 dictionary_additions_.push_back( |
291 DictionaryAdditions(dictionary_text, dictionary_url)); | 291 DictionaryAdditions(dictionary_text, dictionary_url)); |
292 } | 292 } |
293 | 293 |
294 // Return (in |*out|) all dictionary additions since the last time | 294 // Return (in |*out|) all dictionary additions since the last time |
295 // this function was called. | 295 // this function was called. |
296 void GetDictionaryAdditions(std::vector<DictionaryAdditions>* out) { | 296 void GetDictionaryAdditions(std::vector<DictionaryAdditions>* out) { |
297 out->swap(dictionary_additions_); | 297 out->swap(dictionary_additions_); |
298 dictionary_additions_.clear(); | 298 dictionary_additions_.clear(); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 // Should only have a dictionary for the successful request. | 570 // Should only have a dictionary for the successful request. |
571 ASSERT_EQ(1u, additions.size()); | 571 ASSERT_EQ(1u, additions.size()); |
572 EXPECT_EQ( | 572 EXPECT_EQ( |
573 URLRequestSpecifiedResponseJob::ExpectedResponseForURL(dictionary_url), | 573 URLRequestSpecifiedResponseJob::ExpectedResponseForURL(dictionary_url), |
574 additions[0].dictionary_text); | 574 additions[0].dictionary_text); |
575 } | 575 } |
576 | 576 |
577 } // namespace | 577 } // namespace |
578 | 578 |
579 } // namespace net | 579 } // namespace net |
OLD | NEW |