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

Side by Side Diff: components/error_page/renderer/net_error_helper_core_unittest.cc

Issue 684513002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 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 "components/error_page/renderer/net_error_helper_core.h" 5 #include "components/error_page/renderer/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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 error_html_update_count_(0), 152 error_html_update_count_(0),
153 reload_count_(0), 153 reload_count_(0),
154 load_stale_count_(0), 154 load_stale_count_(0),
155 enable_page_helper_functions_count_(0), 155 enable_page_helper_functions_count_(0),
156 default_url_(GURL(kFailedUrl)), 156 default_url_(GURL(kFailedUrl)),
157 error_url_(GURL(content::kUnreachableWebDataURL)), 157 error_url_(GURL(content::kUnreachableWebDataURL)),
158 tracking_request_count_(0) { 158 tracking_request_count_(0) {
159 SetUpCore(false, false, true); 159 SetUpCore(false, false, true);
160 } 160 }
161 161
162 virtual ~NetErrorHelperCoreTest() { 162 ~NetErrorHelperCoreTest() override {
163 // No test finishes while an error page is being fetched. 163 // No test finishes while an error page is being fetched.
164 EXPECT_FALSE(is_url_being_fetched()); 164 EXPECT_FALSE(is_url_being_fetched());
165 } 165 }
166 166
167 virtual void SetUp() override { 167 void SetUp() override { base::StatisticsRecorder::Initialize(); }
168 base::StatisticsRecorder::Initialize();
169 }
170 168
171 void SetUpCore(bool auto_reload_enabled, 169 void SetUpCore(bool auto_reload_enabled,
172 bool auto_reload_visible_only, 170 bool auto_reload_visible_only,
173 bool visible) { 171 bool visible) {
174 // The old value of timer_, if any, will be freed by the old core_ being 172 // The old value of timer_, if any, will be freed by the old core_ being
175 // destructed, since core_ takes ownership of the timer. 173 // destructed, since core_ takes ownership of the timer.
176 timer_ = new base::MockTimer(false, false); 174 timer_ = new base::MockTimer(false, false);
177 core_.reset(new NetErrorHelperCore(this, 175 core_.reset(new NetErrorHelperCore(this,
178 auto_reload_enabled, 176 auto_reload_enabled,
179 auto_reload_visible_only, 177 auto_reload_visible_only,
(...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after
1932 1930
1933 TEST_F(NetErrorHelperCoreTest, AutoReloadDisabled) { 1931 TEST_F(NetErrorHelperCoreTest, AutoReloadDisabled) {
1934 DoErrorLoad(net::ERR_CONNECTION_RESET); 1932 DoErrorLoad(net::ERR_CONNECTION_RESET);
1935 1933
1936 EXPECT_FALSE(timer()->IsRunning()); 1934 EXPECT_FALSE(timer()->IsRunning());
1937 EXPECT_EQ(0, reload_count()); 1935 EXPECT_EQ(0, reload_count());
1938 } 1936 }
1939 1937
1940 class NetErrorHelperCoreAutoReloadTest : public NetErrorHelperCoreTest { 1938 class NetErrorHelperCoreAutoReloadTest : public NetErrorHelperCoreTest {
1941 public: 1939 public:
1942 virtual void SetUp() { 1940 void SetUp() override {
1943 NetErrorHelperCoreTest::SetUp(); 1941 NetErrorHelperCoreTest::SetUp();
1944 SetUpCore(true, false, true); 1942 SetUpCore(true, false, true);
1945 } 1943 }
1946 }; 1944 };
1947 1945
1948 TEST_F(NetErrorHelperCoreAutoReloadTest, Succeeds) { 1946 TEST_F(NetErrorHelperCoreAutoReloadTest, Succeeds) {
1949 DoErrorLoad(net::ERR_CONNECTION_RESET); 1947 DoErrorLoad(net::ERR_CONNECTION_RESET);
1950 1948
1951 EXPECT_TRUE(timer()->IsRunning()); 1949 EXPECT_TRUE(timer()->IsRunning());
1952 EXPECT_EQ(0, reload_count()); 1950 EXPECT_EQ(0, reload_count());
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
2236 SetUpCore(true, true, false); 2234 SetUpCore(true, true, false);
2237 DoErrorLoad(net::ERR_CONNECTION_RESET); 2235 DoErrorLoad(net::ERR_CONNECTION_RESET);
2238 EXPECT_FALSE(timer()->IsRunning()); 2236 EXPECT_FALSE(timer()->IsRunning());
2239 core()->OnWasShown(); 2237 core()->OnWasShown();
2240 EXPECT_TRUE(timer()->IsRunning()); 2238 EXPECT_TRUE(timer()->IsRunning());
2241 } 2239 }
2242 2240
2243 class NetErrorHelperCoreHistogramTest 2241 class NetErrorHelperCoreHistogramTest
2244 : public NetErrorHelperCoreAutoReloadTest { 2242 : public NetErrorHelperCoreAutoReloadTest {
2245 public: 2243 public:
2246 virtual void SetUp() override { 2244 void SetUp() override { NetErrorHelperCoreAutoReloadTest::SetUp(); }
2247 NetErrorHelperCoreAutoReloadTest::SetUp();
2248 }
2249 2245
2250 static const char kCountAtStop[]; 2246 static const char kCountAtStop[];
2251 static const char kErrorAtStop[]; 2247 static const char kErrorAtStop[];
2252 static const char kCountAtSuccess[]; 2248 static const char kCountAtSuccess[];
2253 static const char kErrorAtSuccess[]; 2249 static const char kErrorAtSuccess[];
2254 static const char kErrorAtFirstSuccess[]; 2250 static const char kErrorAtFirstSuccess[];
2255 2251
2256 protected: 2252 protected:
2257 base::HistogramTester histogram_tester_; 2253 base::HistogramTester histogram_tester_;
2258 }; 2254 };
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
2435 TEST_F(NetErrorHelperCoreTest, ExplicitLoadStaleSucceeds) { 2431 TEST_F(NetErrorHelperCoreTest, ExplicitLoadStaleSucceeds) {
2436 DoErrorLoad(net::ERR_CONNECTION_RESET); 2432 DoErrorLoad(net::ERR_CONNECTION_RESET);
2437 EXPECT_EQ(0, load_stale_count()); 2433 EXPECT_EQ(0, load_stale_count());
2438 core()->ExecuteButtonPress(NetErrorHelperCore::LOAD_STALE_BUTTON); 2434 core()->ExecuteButtonPress(NetErrorHelperCore::LOAD_STALE_BUTTON);
2439 EXPECT_EQ(1, load_stale_count()); 2435 EXPECT_EQ(1, load_stale_count());
2440 EXPECT_EQ(GURL(kFailedUrl), load_stale_url()); 2436 EXPECT_EQ(GURL(kFailedUrl), load_stale_url());
2441 } 2437 }
2442 2438
2443 } // namespace 2439 } // namespace
2444 } // namespace error_page 2440 } // namespace error_page
OLDNEW
« no previous file with comments | « components/enhanced_bookmarks/enhanced_bookmark_utils_unittest.cc ('k') | components/feedback/feedback_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698