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

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

Issue 12210030: Linux/ChromeOS Chromium style checker cleanup, content/ edition. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 10 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 (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/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 GeolocationArbitrator* LocationProviderForTestArbitrator::CreateArbitrator() { 47 GeolocationArbitrator* LocationProviderForTestArbitrator::CreateArbitrator() {
48 DCHECK(mock_arbitrator_ == NULL); 48 DCHECK(mock_arbitrator_ == NULL);
49 mock_arbitrator_ = new MockGeolocationArbitrator; 49 mock_arbitrator_ = new MockGeolocationArbitrator;
50 return mock_arbitrator_; 50 return mock_arbitrator_;
51 } 51 }
52 52
53 class NullGeolocationObserver : public GeolocationObserver { 53 class NullGeolocationObserver : public GeolocationObserver {
54 public: 54 public:
55 // GeolocationObserver 55 // GeolocationObserver
56 virtual void OnLocationUpdate(const Geoposition& position) {} 56 virtual void OnLocationUpdate(const Geoposition& position) OVERRIDE {}
57 }; 57 };
58 58
59 class MockGeolocationObserver : public GeolocationObserver { 59 class MockGeolocationObserver : public GeolocationObserver {
60 public: 60 public:
61 // GeolocationObserver 61 // GeolocationObserver
62 MOCK_METHOD1(OnLocationUpdate, void(const Geoposition& position)); 62 MOCK_METHOD1(OnLocationUpdate, void(const Geoposition& position));
63 }; 63 };
64 64
65 class AsyncMockGeolocationObserver : public MockGeolocationObserver { 65 class AsyncMockGeolocationObserver : public MockGeolocationObserver {
66 public: 66 public:
67 // GeolocationObserver 67 // GeolocationObserver
68 virtual void OnLocationUpdate(const Geoposition& position) { 68 virtual void OnLocationUpdate(const Geoposition& position) OVERRIDE {
69 MockGeolocationObserver::OnLocationUpdate(position); 69 MockGeolocationObserver::OnLocationUpdate(position);
70 MessageLoop::current()->Quit(); 70 MessageLoop::current()->Quit();
71 } 71 }
72 }; 72 };
73 73
74 class MockGeolocationCallbackWrapper { 74 class MockGeolocationCallbackWrapper {
75 public: 75 public:
76 MOCK_METHOD1(Callback, void(const Geoposition& position)); 76 MOCK_METHOD1(Callback, void(const Geoposition& position));
77 }; 77 };
78 78
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 115 }
116 116
117 class GeolocationProviderTest : public testing::Test { 117 class GeolocationProviderTest : public testing::Test {
118 protected: 118 protected:
119 GeolocationProviderTest() 119 GeolocationProviderTest()
120 : message_loop_(), 120 : message_loop_(),
121 io_thread_(BrowserThread::IO, &message_loop_), 121 io_thread_(BrowserThread::IO, &message_loop_),
122 provider_(new LocationProviderForTestArbitrator) { 122 provider_(new LocationProviderForTestArbitrator) {
123 } 123 }
124 124
125 ~GeolocationProviderTest() {} 125 virtual ~GeolocationProviderTest() {}
126 126
127 LocationProviderForTestArbitrator* provider() { return provider_.get(); } 127 LocationProviderForTestArbitrator* provider() { return provider_.get(); }
128 128
129 // Called on test thread. 129 // Called on test thread.
130 bool ProvidersStarted(); 130 bool ProvidersStarted();
131 void SendMockLocation(const Geoposition& position); 131 void SendMockLocation(const Geoposition& position);
132 132
133 private: 133 private:
134 // Called on provider thread. 134 // Called on provider thread.
135 void GetProvidersStarted(bool* started); 135 void GetProvidersStarted(bool* started);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 position.longitude = 34; 253 position.longitude = 34;
254 position.accuracy = 56; 254 position.accuracy = 56;
255 position.timestamp = base::Time::Now(); 255 position.timestamp = base::Time::Now();
256 EXPECT_CALL(callback_wrapper, Callback(GeopositionEq(position))); 256 EXPECT_CALL(callback_wrapper, Callback(GeopositionEq(position)));
257 provider()->OverrideLocationForTesting(position); 257 provider()->OverrideLocationForTesting(position);
258 // Wait for the providers to be stopped now that all clients are gone. 258 // Wait for the providers to be stopped now that all clients are gone.
259 EXPECT_FALSE(ProvidersStarted()); 259 EXPECT_FALSE(ProvidersStarted());
260 } 260 }
261 261
262 } // namespace content 262 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698