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

Side by Side Diff: chrome/renderer/net/net_error_helper_core_unittest.cc

Issue 630603003: Replacing the OVERRIDE with override in chrome/renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased the patch 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 | « chrome/renderer/net/net_error_helper.h ('k') | chrome/renderer/net/net_error_page_controller.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/renderer/net/net_error_helper_core.h" 5 #include "chrome/renderer/net/net_error_helper_core.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 error_url_(GURL(content::kUnreachableWebDataURL)), 154 error_url_(GURL(content::kUnreachableWebDataURL)),
155 tracking_request_count_(0) { 155 tracking_request_count_(0) {
156 SetUpCore(false, false, true); 156 SetUpCore(false, false, true);
157 } 157 }
158 158
159 virtual ~NetErrorHelperCoreTest() { 159 virtual ~NetErrorHelperCoreTest() {
160 // No test finishes while an error page is being fetched. 160 // No test finishes while an error page is being fetched.
161 EXPECT_FALSE(is_url_being_fetched()); 161 EXPECT_FALSE(is_url_being_fetched());
162 } 162 }
163 163
164 virtual void SetUp() OVERRIDE { 164 virtual void SetUp() override {
165 base::StatisticsRecorder::Initialize(); 165 base::StatisticsRecorder::Initialize();
166 } 166 }
167 167
168 void SetUpCore(bool auto_reload_enabled, 168 void SetUpCore(bool auto_reload_enabled,
169 bool auto_reload_visible_only, 169 bool auto_reload_visible_only,
170 bool visible) { 170 bool visible) {
171 // The old value of timer_, if any, will be freed by the old core_ being 171 // The old value of timer_, if any, will be freed by the old core_ being
172 // destructed, since core_ takes ownership of the timer. 172 // destructed, since core_ takes ownership of the timer.
173 timer_ = new base::MockTimer(false, false); 173 timer_ = new base::MockTimer(false, false);
174 core_.reset(new NetErrorHelperCore(this, 174 core_.reset(new NetErrorHelperCore(this,
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 GURL(kSearchUrl)); 292 GURL(kSearchUrl));
293 } 293 }
294 294
295 // NetErrorHelperCore::Delegate implementation: 295 // NetErrorHelperCore::Delegate implementation:
296 virtual void GenerateLocalizedErrorPage( 296 virtual void GenerateLocalizedErrorPage(
297 const WebURLError& error, 297 const WebURLError& error,
298 bool is_failed_post, 298 bool is_failed_post,
299 scoped_ptr<LocalizedError::ErrorPageParams> params, 299 scoped_ptr<LocalizedError::ErrorPageParams> params,
300 bool* reload_button_shown, 300 bool* reload_button_shown,
301 bool* load_stale_button_shown, 301 bool* load_stale_button_shown,
302 std::string* html) const OVERRIDE { 302 std::string* html) const override {
303 last_error_page_params_.reset(params.release()); 303 last_error_page_params_.reset(params.release());
304 *reload_button_shown = false; 304 *reload_button_shown = false;
305 *load_stale_button_shown = false; 305 *load_stale_button_shown = false;
306 *html = ErrorToString(error, is_failed_post); 306 *html = ErrorToString(error, is_failed_post);
307 } 307 }
308 308
309 virtual void LoadErrorPageInMainFrame(const std::string& html, 309 virtual void LoadErrorPageInMainFrame(const std::string& html,
310 const GURL& failed_url) OVERRIDE { 310 const GURL& failed_url) override {
311 error_html_update_count_++; 311 error_html_update_count_++;
312 last_error_html_ = html; 312 last_error_html_ = html;
313 } 313 }
314 314
315 virtual void EnablePageHelperFunctions() OVERRIDE { 315 virtual void EnablePageHelperFunctions() override {
316 enable_page_helper_functions_count_++; 316 enable_page_helper_functions_count_++;
317 } 317 }
318 318
319 virtual void UpdateErrorPage(const WebURLError& error, 319 virtual void UpdateErrorPage(const WebURLError& error,
320 bool is_failed_post) OVERRIDE { 320 bool is_failed_post) override {
321 update_count_++; 321 update_count_++;
322 last_error_page_params_.reset(NULL); 322 last_error_page_params_.reset(NULL);
323 last_error_html_ = ErrorToString(error, is_failed_post); 323 last_error_html_ = ErrorToString(error, is_failed_post);
324 } 324 }
325 325
326 virtual void FetchNavigationCorrections( 326 virtual void FetchNavigationCorrections(
327 const GURL& navigation_correction_url, 327 const GURL& navigation_correction_url,
328 const std::string& navigation_correction_request_body) OVERRIDE { 328 const std::string& navigation_correction_request_body) override {
329 EXPECT_TRUE(url_being_fetched_.is_empty()); 329 EXPECT_TRUE(url_being_fetched_.is_empty());
330 EXPECT_TRUE(request_body_.empty()); 330 EXPECT_TRUE(request_body_.empty());
331 EXPECT_EQ(GURL(kNavigationCorrectionUrl), navigation_correction_url); 331 EXPECT_EQ(GURL(kNavigationCorrectionUrl), navigation_correction_url);
332 332
333 url_being_fetched_ = navigation_correction_url; 333 url_being_fetched_ = navigation_correction_url;
334 request_body_ = navigation_correction_request_body; 334 request_body_ = navigation_correction_request_body;
335 335
336 // Check the body of the request. 336 // Check the body of the request.
337 337
338 base::JSONReader reader; 338 base::JSONReader reader;
339 scoped_ptr<base::Value> parsed_body(reader.Read( 339 scoped_ptr<base::Value> parsed_body(reader.Read(
340 navigation_correction_request_body)); 340 navigation_correction_request_body));
341 ASSERT_TRUE(parsed_body); 341 ASSERT_TRUE(parsed_body);
342 base::DictionaryValue* dict = NULL; 342 base::DictionaryValue* dict = NULL;
343 ASSERT_TRUE(parsed_body->GetAsDictionary(&dict)); 343 ASSERT_TRUE(parsed_body->GetAsDictionary(&dict));
344 344
345 EXPECT_TRUE(StringValueEquals(*dict, "params.urlQuery", kFailedUrl)); 345 EXPECT_TRUE(StringValueEquals(*dict, "params.urlQuery", kFailedUrl));
346 EXPECT_TRUE(StringValueEquals(*dict, "params.language", kLanguage)); 346 EXPECT_TRUE(StringValueEquals(*dict, "params.language", kLanguage));
347 EXPECT_TRUE(StringValueEquals(*dict, "params.originCountry", kCountry)); 347 EXPECT_TRUE(StringValueEquals(*dict, "params.originCountry", kCountry));
348 EXPECT_TRUE(StringValueEquals(*dict, "params.key", kApiKey)); 348 EXPECT_TRUE(StringValueEquals(*dict, "params.key", kApiKey));
349 } 349 }
350 350
351 virtual void CancelFetchNavigationCorrections() OVERRIDE { 351 virtual void CancelFetchNavigationCorrections() override {
352 url_being_fetched_ = GURL(); 352 url_being_fetched_ = GURL();
353 request_body_.clear(); 353 request_body_.clear();
354 } 354 }
355 355
356 virtual void ReloadPage() OVERRIDE { 356 virtual void ReloadPage() override {
357 reload_count_++; 357 reload_count_++;
358 } 358 }
359 359
360 virtual void LoadPageFromCache(const GURL& error_url) OVERRIDE { 360 virtual void LoadPageFromCache(const GURL& error_url) override {
361 load_stale_count_++; 361 load_stale_count_++;
362 load_stale_url_ = error_url; 362 load_stale_url_ = error_url;
363 } 363 }
364 364
365 virtual void SendTrackingRequest( 365 virtual void SendTrackingRequest(
366 const GURL& tracking_url, 366 const GURL& tracking_url,
367 const std::string& tracking_request_body) OVERRIDE { 367 const std::string& tracking_request_body) override {
368 last_tracking_url_ = tracking_url; 368 last_tracking_url_ = tracking_url;
369 last_tracking_request_body_ = tracking_request_body; 369 last_tracking_request_body_ = tracking_request_body;
370 tracking_request_count_++; 370 tracking_request_count_++;
371 371
372 // Check the body of the request. 372 // Check the body of the request.
373 373
374 base::JSONReader reader; 374 base::JSONReader reader;
375 scoped_ptr<base::Value> parsed_body(reader.Read(tracking_request_body)); 375 scoped_ptr<base::Value> parsed_body(reader.Read(tracking_request_body));
376 ASSERT_TRUE(parsed_body); 376 ASSERT_TRUE(parsed_body);
377 base::DictionaryValue* dict = NULL; 377 base::DictionaryValue* dict = NULL;
(...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after
2226 SetUpCore(true, true, false); 2226 SetUpCore(true, true, false);
2227 DoErrorLoad(net::ERR_CONNECTION_RESET); 2227 DoErrorLoad(net::ERR_CONNECTION_RESET);
2228 EXPECT_FALSE(timer()->IsRunning()); 2228 EXPECT_FALSE(timer()->IsRunning());
2229 core()->OnWasShown(); 2229 core()->OnWasShown();
2230 EXPECT_TRUE(timer()->IsRunning()); 2230 EXPECT_TRUE(timer()->IsRunning());
2231 } 2231 }
2232 2232
2233 class NetErrorHelperCoreHistogramTest 2233 class NetErrorHelperCoreHistogramTest
2234 : public NetErrorHelperCoreAutoReloadTest { 2234 : public NetErrorHelperCoreAutoReloadTest {
2235 public: 2235 public:
2236 virtual void SetUp() OVERRIDE { 2236 virtual void SetUp() override {
2237 NetErrorHelperCoreAutoReloadTest::SetUp(); 2237 NetErrorHelperCoreAutoReloadTest::SetUp();
2238 } 2238 }
2239 2239
2240 static const char kCountAtStop[]; 2240 static const char kCountAtStop[];
2241 static const char kErrorAtStop[]; 2241 static const char kErrorAtStop[];
2242 static const char kCountAtSuccess[]; 2242 static const char kCountAtSuccess[];
2243 static const char kErrorAtSuccess[]; 2243 static const char kErrorAtSuccess[];
2244 static const char kErrorAtFirstSuccess[]; 2244 static const char kErrorAtFirstSuccess[];
2245 2245
2246 protected: 2246 protected:
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
2424 2424
2425 TEST_F(NetErrorHelperCoreTest, ExplicitLoadStaleSucceeds) { 2425 TEST_F(NetErrorHelperCoreTest, ExplicitLoadStaleSucceeds) {
2426 DoErrorLoad(net::ERR_CONNECTION_RESET); 2426 DoErrorLoad(net::ERR_CONNECTION_RESET);
2427 EXPECT_EQ(0, load_stale_count()); 2427 EXPECT_EQ(0, load_stale_count());
2428 core()->ExecuteButtonPress(NetErrorHelperCore::LOAD_STALE_BUTTON); 2428 core()->ExecuteButtonPress(NetErrorHelperCore::LOAD_STALE_BUTTON);
2429 EXPECT_EQ(1, load_stale_count()); 2429 EXPECT_EQ(1, load_stale_count());
2430 EXPECT_EQ(GURL(kFailedUrl), load_stale_url()); 2430 EXPECT_EQ(GURL(kFailedUrl), load_stale_url());
2431 } 2431 }
2432 2432
2433 } // namespace 2433 } // namespace
OLDNEW
« no previous file with comments | « chrome/renderer/net/net_error_helper.h ('k') | chrome/renderer/net/net_error_page_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698