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

Side by Side Diff: content/browser/geolocation/network_location_provider_unittest.cc

Issue 667943003: Standardize usage of virtual/override/final in content/browser/ (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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/json/json_reader.h" 5 #include "base/json/json_reader.h"
6 #include "base/json/json_writer.h" 6 #include "base/json/json_writer.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 static MockWifiDataProvider* CreateInstance() { 60 static MockWifiDataProvider* CreateInstance() {
61 CHECK(!instance_); 61 CHECK(!instance_);
62 instance_ = new MockWifiDataProvider; 62 instance_ = new MockWifiDataProvider;
63 return instance_; 63 return instance_;
64 } 64 }
65 65
66 MockWifiDataProvider() : start_calls_(0), stop_calls_(0), got_data_(true) {} 66 MockWifiDataProvider() : start_calls_(0), stop_calls_(0), got_data_(true) {}
67 67
68 // WifiDataProvider implementation. 68 // WifiDataProvider implementation.
69 virtual void StartDataProvider() override { 69 void StartDataProvider() override { ++start_calls_; }
70 ++start_calls_;
71 }
72 70
73 virtual void StopDataProvider() override { 71 void StopDataProvider() override { ++stop_calls_; }
74 ++stop_calls_;
75 }
76 72
77 virtual bool GetData(WifiData* data_out) override { 73 bool GetData(WifiData* data_out) override {
78 CHECK(data_out); 74 CHECK(data_out);
79 *data_out = data_; 75 *data_out = data_;
80 return got_data_; 76 return got_data_;
81 } 77 }
82 78
83 void SetData(const WifiData& new_data) { 79 void SetData(const WifiData& new_data) {
84 got_data_ = true; 80 got_data_ = true;
85 const bool differs = data_.DiffersSignificantly(new_data); 81 const bool differs = data_.DiffersSignificantly(new_data);
86 data_ = new_data; 82 data_ = new_data;
87 if (differs) 83 if (differs)
88 this->RunCallbacks(); 84 this->RunCallbacks();
89 } 85 }
90 86
91 void set_got_data(bool got_data) { got_data_ = got_data; } 87 void set_got_data(bool got_data) { got_data_ = got_data; }
92 int start_calls_; 88 int start_calls_;
93 int stop_calls_; 89 int stop_calls_;
94 90
95 private: 91 private:
96 virtual ~MockWifiDataProvider() { 92 ~MockWifiDataProvider() override {
97 CHECK(this == instance_); 93 CHECK(this == instance_);
98 instance_ = NULL; 94 instance_ = NULL;
99 } 95 }
100 96
101 static MockWifiDataProvider* instance_; 97 static MockWifiDataProvider* instance_;
102 98
103 WifiData data_; 99 WifiData data_;
104 bool got_data_; 100 bool got_data_;
105 101
106 DISALLOW_COPY_AND_ASSIGN(MockWifiDataProvider); 102 DISALLOW_COPY_AND_ASSIGN(MockWifiDataProvider);
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(1))); 546 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(1)));
551 } else { 547 } else {
552 const int evicted = i - kCacheSize; 548 const int evicted = i - kCacheSize;
553 EXPECT_FALSE(cache.FindPosition(CreateReferenceWifiScanData(evicted))); 549 EXPECT_FALSE(cache.FindPosition(CreateReferenceWifiScanData(evicted)));
554 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(evicted + 1))); 550 EXPECT_TRUE(cache.FindPosition(CreateReferenceWifiScanData(evicted + 1)));
555 } 551 }
556 } 552 }
557 } 553 }
558 554
559 } // namespace content 555 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/geolocation/network_location_provider.h ('k') | content/browser/geolocation/network_location_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698