| 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 virtual void AddSdchDictionary(const std::string& dictionary_text, | 89 virtual SdchProblemCodes AddSdchDictionary( |
| 90 const GURL& dictionary_url) OVERRIDE { | 90 const std::string& dictionary_text, |
| 91 const GURL& dictionary_url) OVERRIDE { |
| 91 dictionary_additions.push_back( | 92 dictionary_additions.push_back( |
| 92 DictionaryAdditions(dictionary_text, dictionary_url)); | 93 DictionaryAdditions(dictionary_text, dictionary_url)); |
| 94 return SDCH_OK; |
| 93 } | 95 } |
| 94 | 96 |
| 95 void GetDictionaryAdditions(std::vector<DictionaryAdditions>* out) { | 97 void GetDictionaryAdditions(std::vector<DictionaryAdditions>* out) { |
| 96 out->swap(dictionary_additions); | 98 out->swap(dictionary_additions); |
| 97 dictionary_additions.clear(); | 99 dictionary_additions.clear(); |
| 98 } | 100 } |
| 99 | 101 |
| 100 private: | 102 private: |
| 101 std::vector<DictionaryAdditions> dictionary_additions; | 103 std::vector<DictionaryAdditions> dictionary_additions; |
| 102 }; | 104 }; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 fetcher()->Schedule(dictionary_url_2); | 186 fetcher()->Schedule(dictionary_url_2); |
| 185 fetcher()->Schedule(dictionary_url_3); | 187 fetcher()->Schedule(dictionary_url_3); |
| 186 fetcher()->Cancel(); | 188 fetcher()->Cancel(); |
| 187 base::RunLoop().RunUntilIdle(); | 189 base::RunLoop().RunUntilIdle(); |
| 188 | 190 |
| 189 // Synchronous execution may have resulted in a single job being scheduled. | 191 // Synchronous execution may have resulted in a single job being scheduled. |
| 190 EXPECT_GE(1, JobsRequested()); | 192 EXPECT_GE(1, JobsRequested()); |
| 191 } | 193 } |
| 192 | 194 |
| 193 } | 195 } |
| OLD | NEW |