| 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/base/sdch_dictionary_fetcher.h" | 5 #include "net/base/sdch_dictionary_fetcher.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 DictionaryAdditions(const std::string& dictionary_text, | 79 DictionaryAdditions(const std::string& dictionary_text, |
| 80 const GURL& dictionary_url) | 80 const GURL& dictionary_url) |
| 81 : dictionary_text(dictionary_text), | 81 : dictionary_text(dictionary_text), |
| 82 dictionary_url(dictionary_url) {} | 82 dictionary_url(dictionary_url) {} |
| 83 | 83 |
| 84 | 84 |
| 85 std::string dictionary_text; | 85 std::string dictionary_text; |
| 86 GURL dictionary_url; | 86 GURL dictionary_url; |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 SdchProblemCode AddSdchDictionary(const std::string& dictionary_text, | 89 void AddSdchDictionary(const std::string& dictionary_text, |
| 90 const GURL& dictionary_url) override { | 90 const GURL& dictionary_url) override { |
| 91 dictionary_additions.push_back( | 91 dictionary_additions.push_back( |
| 92 DictionaryAdditions(dictionary_text, dictionary_url)); | 92 DictionaryAdditions(dictionary_text, dictionary_url)); |
| 93 return SDCH_OK; | |
| 94 } | 93 } |
| 95 | 94 |
| 96 void GetDictionaryAdditions(std::vector<DictionaryAdditions>* out) { | 95 void GetDictionaryAdditions(std::vector<DictionaryAdditions>* out) { |
| 97 out->swap(dictionary_additions); | 96 out->swap(dictionary_additions); |
| 98 dictionary_additions.clear(); | 97 dictionary_additions.clear(); |
| 99 } | 98 } |
| 100 | 99 |
| 101 private: | 100 private: |
| 102 std::vector<DictionaryAdditions> dictionary_additions; | 101 std::vector<DictionaryAdditions> dictionary_additions; |
| 103 }; | 102 }; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 fetcher()->Schedule(dictionary_url_2); | 184 fetcher()->Schedule(dictionary_url_2); |
| 186 fetcher()->Schedule(dictionary_url_3); | 185 fetcher()->Schedule(dictionary_url_3); |
| 187 fetcher()->Cancel(); | 186 fetcher()->Cancel(); |
| 188 base::RunLoop().RunUntilIdle(); | 187 base::RunLoop().RunUntilIdle(); |
| 189 | 188 |
| 190 // Synchronous execution may have resulted in a single job being scheduled. | 189 // Synchronous execution may have resulted in a single job being scheduled. |
| 191 EXPECT_GE(1, JobsRequested()); | 190 EXPECT_GE(1, JobsRequested()); |
| 192 } | 191 } |
| 193 | 192 |
| 194 } | 193 } |
| OLD | NEW |