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

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

Issue 667923003: Standardize usage of virtual/override/final in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months 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
« no previous file with comments | « net/base/sdch_dictionary_fetcher.h ('k') | net/base/sdch_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 static std::string ExpectedResponseForURL(const GURL& url) { 52 static std::string ExpectedResponseForURL(const GURL& url) {
53 return base::StringPrintf("Response for %s\n%s\nEnd Response for %s\n", 53 return base::StringPrintf("Response for %s\n%s\nEnd Response for %s\n",
54 url.spec().c_str(), kSampleBufferContext, 54 url.spec().c_str(), kSampleBufferContext,
55 url.spec().c_str()); 55 url.spec().c_str());
56 } 56 }
57 57
58 static int jobs_requested() { return jobs_requested_; } 58 static int jobs_requested() { return jobs_requested_; }
59 59
60 private: 60 private:
61 virtual ~URLRequestSpecifiedResponseJob() {}; 61 ~URLRequestSpecifiedResponseJob() override{};
62 virtual int GetData(std::string* mime_type, 62 int GetData(std::string* mime_type,
63 std::string* charset, 63 std::string* charset,
64 std::string* data, 64 std::string* data,
65 const CompletionCallback& callback) const override { 65 const CompletionCallback& callback) const override {
66 GURL url(request_->url()); 66 GURL url(request_->url());
67 *data = ExpectedResponseForURL(url); 67 *data = ExpectedResponseForURL(url);
68 return OK; 68 return OK;
69 } 69 }
70 70
71 static int jobs_requested_; 71 static int jobs_requested_;
72 }; 72 };
73 73
74 int URLRequestSpecifiedResponseJob::jobs_requested_(0); 74 int URLRequestSpecifiedResponseJob::jobs_requested_(0);
75 75
76 class SdchTestDelegate : public SdchFetcher::Delegate { 76 class SdchTestDelegate : public SdchFetcher::Delegate {
77 public: 77 public:
78 struct DictionaryAdditions { 78 struct DictionaryAdditions {
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 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 } 93 }
94 94
95 void GetDictionaryAdditions(std::vector<DictionaryAdditions>* out) { 95 void GetDictionaryAdditions(std::vector<DictionaryAdditions>* out) {
96 out->swap(dictionary_additions); 96 out->swap(dictionary_additions);
97 dictionary_additions.clear(); 97 dictionary_additions.clear();
98 } 98 }
99 99
100 private: 100 private:
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 fetcher()->Schedule(dictionary_url_2); 184 fetcher()->Schedule(dictionary_url_2);
185 fetcher()->Schedule(dictionary_url_3); 185 fetcher()->Schedule(dictionary_url_3);
186 fetcher()->Cancel(); 186 fetcher()->Cancel();
187 base::RunLoop().RunUntilIdle(); 187 base::RunLoop().RunUntilIdle();
188 188
189 // Synchronous execution may have resulted in a single job being scheduled. 189 // Synchronous execution may have resulted in a single job being scheduled.
190 EXPECT_GE(1, JobsRequested()); 190 EXPECT_GE(1, JobsRequested());
191 } 191 }
192 192
193 } 193 }
OLDNEW
« no previous file with comments | « net/base/sdch_dictionary_fetcher.h ('k') | net/base/sdch_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698