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

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

Issue 248123002: Added histograms to https://codereview.chromium.org/207553008/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated Nico's comments. Created 6 years, 7 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 | Annotate | Revision Log
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 "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/timer/mock_timer.h" 10 #include "base/timer/mock_timer.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 return ErrorToString(ProbeError(status), false); 107 return ErrorToString(ProbeError(status), false);
108 } 108 }
109 109
110 std::string NetErrorString(net::Error net_error) { 110 std::string NetErrorString(net::Error net_error) {
111 return ErrorToString(NetError(net_error), false); 111 return ErrorToString(NetError(net_error), false);
112 } 112 }
113 113
114 class NetErrorHelperCoreTest : public testing::Test, 114 class NetErrorHelperCoreTest : public testing::Test,
115 public NetErrorHelperCore::Delegate { 115 public NetErrorHelperCore::Delegate {
116 public: 116 public:
117 NetErrorHelperCoreTest() : timer_(new base::MockTimer(false, false)), 117 NetErrorHelperCoreTest()
118 core_(this), 118 : timer_(new base::MockTimer(false, false)),
119 update_count_(0), 119 core_(this),
120 error_html_update_count_(0), 120 update_count_(0),
121 reload_count_(0), 121 error_html_update_count_(0),
122 load_stale_count_(0), 122 reload_count_(0),
123 enable_page_helper_functions_count_(0) { 123 load_stale_count_(0),
124 enable_page_helper_functions_count_(0) {
124 core_.set_auto_reload_enabled(false); 125 core_.set_auto_reload_enabled(false);
125 core_.set_timer_for_testing(scoped_ptr<base::Timer>(timer_)); 126 core_.set_timer_for_testing(scoped_ptr<base::Timer>(timer_));
126 } 127 }
127 128
128 virtual ~NetErrorHelperCoreTest() { 129 virtual ~NetErrorHelperCoreTest() {
129 // No test finishes while an error page is being fetched. 130 // No test finishes while an error page is being fetched.
130 EXPECT_FALSE(is_url_being_fetched()); 131 EXPECT_FALSE(is_url_being_fetched());
131 } 132 }
132 133
133 NetErrorHelperCore& core() { return core_; } 134 NetErrorHelperCore& core() { return core_; }
(...skipping 1880 matching lines...) Expand 10 before | Expand all | Expand 10 after
2014 2015
2015 TEST_F(NetErrorHelperCoreTest, ExplicitLoadStaleSucceeds) { 2016 TEST_F(NetErrorHelperCoreTest, ExplicitLoadStaleSucceeds) {
2016 DoErrorLoad(net::ERR_CONNECTION_RESET); 2017 DoErrorLoad(net::ERR_CONNECTION_RESET);
2017 EXPECT_EQ(0, load_stale_count()); 2018 EXPECT_EQ(0, load_stale_count());
2018 core().ExecuteButtonPress(NetErrorHelperCore::LOAD_STALE_BUTTON); 2019 core().ExecuteButtonPress(NetErrorHelperCore::LOAD_STALE_BUTTON);
2019 EXPECT_EQ(1, load_stale_count()); 2020 EXPECT_EQ(1, load_stale_count());
2020 EXPECT_EQ(GURL(kFailedUrl), load_stale_url()); 2021 EXPECT_EQ(GURL(kFailedUrl), load_stale_url());
2021 } 2022 }
2022 2023
2023 2024
OLDNEW
« no previous file with comments | « chrome/renderer/net/net_error_helper_core.h ('k') | chrome/renderer/net/net_error_page_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698