Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: net/base/sdch_dictionary_fetcher_unittest.cc

Issue 423813002: Sdch view for net-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Declare SdchProblemCode Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 void AddSdchDictionary(const std::string& dictionary_text, 89 SdchProblemCode 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;
93 } 94 }
94 95
95 void GetDictionaryAdditions(std::vector<DictionaryAdditions>* out) { 96 void GetDictionaryAdditions(std::vector<DictionaryAdditions>* out) {
96 out->swap(dictionary_additions); 97 out->swap(dictionary_additions);
97 dictionary_additions.clear(); 98 dictionary_additions.clear();
98 } 99 }
99 100
100 private: 101 private:
101 std::vector<DictionaryAdditions> dictionary_additions; 102 std::vector<DictionaryAdditions> dictionary_additions;
102 }; 103 };
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 fetcher()->Schedule(dictionary_url_2); 185 fetcher()->Schedule(dictionary_url_2);
185 fetcher()->Schedule(dictionary_url_3); 186 fetcher()->Schedule(dictionary_url_3);
186 fetcher()->Cancel(); 187 fetcher()->Cancel();
187 base::RunLoop().RunUntilIdle(); 188 base::RunLoop().RunUntilIdle();
188 189
189 // Synchronous execution may have resulted in a single job being scheduled. 190 // Synchronous execution may have resulted in a single job being scheduled.
190 EXPECT_GE(1, JobsRequested()); 191 EXPECT_GE(1, JobsRequested());
191 } 192 }
192 193
193 } 194 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698