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

Side by Side Diff: chrome/browser/extensions/api/dial/dial_registry_unittest.cc

Issue 666153002: Standardize usage of virtual/override/final in chrome/browser/extensions/ (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/compiler_specific.h" 5 #include "base/compiler_specific.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "chrome/browser/extensions/api/dial/dial_device_data.h" 7 #include "chrome/browser/extensions/api/dial/dial_device_data.h"
8 #include "chrome/browser/extensions/api/dial/dial_registry.h" 8 #include "chrome/browser/extensions/api/dial/dial_registry.h"
9 #include "chrome/browser/extensions/api/dial/dial_service.h" 9 #include "chrome/browser/extensions/api/dial/dial_service.h"
10 #include "chrome/test/base/testing_profile.h" 10 #include "chrome/test/base/testing_profile.h"
(...skipping 30 matching lines...) Expand all
41 class MockDialRegistry : public DialRegistry { 41 class MockDialRegistry : public DialRegistry {
42 public: 42 public:
43 MockDialRegistry(Observer *dial_api, 43 MockDialRegistry(Observer *dial_api,
44 const base::TimeDelta& refresh_interval, 44 const base::TimeDelta& refresh_interval,
45 const base::TimeDelta& expiration, 45 const base::TimeDelta& expiration,
46 const size_t max_devices) 46 const size_t max_devices)
47 : DialRegistry(dial_api, refresh_interval, expiration, max_devices) { 47 : DialRegistry(dial_api, refresh_interval, expiration, max_devices) {
48 time_ = Time::Now(); 48 time_ = Time::Now();
49 } 49 }
50 50
51 virtual ~MockDialRegistry() { 51 ~MockDialRegistry() override {
52 // Don't let the DialRegistry delete this. 52 // Don't let the DialRegistry delete this.
53 DialService* tmp = dial_.release(); 53 DialService* tmp = dial_.release();
54 if (tmp != NULL) 54 if (tmp != NULL)
55 CHECK_EQ(&mock_service_, tmp); 55 CHECK_EQ(&mock_service_, tmp);
56 } 56 }
57 57
58 // Returns the mock Dial service. 58 // Returns the mock Dial service.
59 MockDialService& mock_service() { 59 MockDialService& mock_service() {
60 return mock_service_; 60 return mock_service_;
61 } 61 }
62 62
63 // Set to mock out the current time. 63 // Set to mock out the current time.
64 Time time_; 64 Time time_;
65 65
66 protected: 66 protected:
67 virtual base::Time Now() const override { 67 base::Time Now() const override { return time_; }
68 return time_;
69 }
70 68
71 virtual DialService* CreateDialService() override { 69 DialService* CreateDialService() override { return &mock_service_; }
72 return &mock_service_;
73 }
74 70
75 virtual void ClearDialService() override { 71 void ClearDialService() override {
76 // Release the pointer but don't delete the object because the test owns it. 72 // Release the pointer but don't delete the object because the test owns it.
77 CHECK_EQ(&mock_service_, dial_.release()); 73 CHECK_EQ(&mock_service_, dial_.release());
78 } 74 }
79 75
80 private: 76 private:
81 MockDialService mock_service_; 77 MockDialService mock_service_;
82 }; 78 };
83 79
84 class DialRegistryTest : public testing::Test { 80 class DialRegistryTest : public testing::Test {
85 public: 81 public:
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 registry_->OnNetworkChanged(net::NetworkChangeNotifier::CONNECTION_ETHERNET); 353 registry_->OnNetworkChanged(net::NetworkChangeNotifier::CONNECTION_ETHERNET);
358 354
359 registry_->OnDiscoveryRequest(NULL); 355 registry_->OnDiscoveryRequest(NULL);
360 registry_->OnDeviceDiscovered(NULL, third_device_); 356 registry_->OnDeviceDiscovered(NULL, third_device_);
361 registry_->OnDiscoveryFinished(NULL); 357 registry_->OnDiscoveryFinished(NULL);
362 358
363 registry_->OnListenerRemoved(); 359 registry_->OnListenerRemoved();
364 } 360 }
365 361
366 } // namespace extensions 362 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/dial/dial_registry.h ('k') | chrome/browser/extensions/api/dial/dial_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698