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

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

Issue 16294003: Update content/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "content/browser/geolocation/fake_access_token_store.h" 7 #include "content/browser/geolocation/fake_access_token_store.h"
8 #include "content/browser/geolocation/location_arbitrator_impl.h" 8 #include "content/browser/geolocation/location_arbitrator_impl.h"
9 #include "content/browser/geolocation/location_provider.h" 9 #include "content/browser/geolocation/location_provider.h"
10 #include "content/browser/geolocation/mock_location_provider.h" 10 #include "content/browser/geolocation/mock_location_provider.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 return arbitrator_->gps_; 146 return arbitrator_->gps_;
147 } 147 }
148 148
149 scoped_refptr<FakeAccessTokenStore> access_token_store_; 149 scoped_refptr<FakeAccessTokenStore> access_token_store_;
150 scoped_ptr<MockLocationObserver> observer_; 150 scoped_ptr<MockLocationObserver> observer_;
151 scoped_ptr<TestingGeolocationArbitrator> arbitrator_; 151 scoped_ptr<TestingGeolocationArbitrator> arbitrator_;
152 base::MessageLoop loop_; 152 base::MessageLoop loop_;
153 }; 153 };
154 154
155 TEST_F(GeolocationLocationArbitratorTest, CreateDestroy) { 155 TEST_F(GeolocationLocationArbitratorTest, CreateDestroy) {
156 EXPECT_TRUE(access_token_store_); 156 EXPECT_TRUE(access_token_store_.get());
157 EXPECT_TRUE(arbitrator_ != NULL); 157 EXPECT_TRUE(arbitrator_ != NULL);
158 arbitrator_.reset(); 158 arbitrator_.reset();
159 SUCCEED(); 159 SUCCEED();
160 } 160 }
161 161
162 TEST_F(GeolocationLocationArbitratorTest, OnPermissionGranted) { 162 TEST_F(GeolocationLocationArbitratorTest, OnPermissionGranted) {
163 EXPECT_FALSE(arbitrator_->HasPermissionBeenGranted()); 163 EXPECT_FALSE(arbitrator_->HasPermissionBeenGranted());
164 arbitrator_->OnPermissionGranted(); 164 arbitrator_->OnPermissionGranted();
165 EXPECT_TRUE(arbitrator_->HasPermissionBeenGranted()); 165 EXPECT_TRUE(arbitrator_->HasPermissionBeenGranted());
166 // Can't check the provider has been notified without going through the 166 // Can't check the provider has been notified without going through the
167 // motions to create the provider (see next test). 167 // motions to create the provider (see next test).
168 EXPECT_FALSE(cell()); 168 EXPECT_FALSE(cell());
169 EXPECT_FALSE(gps()); 169 EXPECT_FALSE(gps());
170 } 170 }
171 171
172 TEST_F(GeolocationLocationArbitratorTest, NormalUsage) { 172 TEST_F(GeolocationLocationArbitratorTest, NormalUsage) {
173 ASSERT_TRUE(access_token_store_); 173 ASSERT_TRUE(access_token_store_.get());
174 ASSERT_TRUE(arbitrator_ != NULL); 174 ASSERT_TRUE(arbitrator_ != NULL);
175 175
176 EXPECT_FALSE(cell()); 176 EXPECT_FALSE(cell());
177 EXPECT_FALSE(gps()); 177 EXPECT_FALSE(gps());
178 arbitrator_->StartProviders(false); 178 arbitrator_->StartProviders(false);
179 179
180 EXPECT_TRUE(access_token_store_->access_token_set_.empty()); 180 EXPECT_TRUE(access_token_store_->access_token_set_.empty());
181 EXPECT_TRUE(access_token_store_->access_token_set_.empty()); 181 EXPECT_TRUE(access_token_store_->access_token_set_.empty());
182 182
183 access_token_store_->NotifyDelegateTokensLoaded(); 183 access_token_store_->NotifyDelegateTokensLoaded();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 CheckLastPositionInfo(3.5657104, 139.690341, 300); 290 CheckLastPositionInfo(3.5657104, 139.690341, 300);
291 291
292 // 2 minutes later 292 // 2 minutes later
293 AdvanceTimeNow(base::TimeDelta::FromMinutes(2)); 293 AdvanceTimeNow(base::TimeDelta::FromMinutes(2));
294 // Arrive in station. Cell moves but GPS is stale. Switch to fresher cell. 294 // Arrive in station. Cell moves but GPS is stale. Switch to fresher cell.
295 SetPositionFix(cell(), 3.5658700, 139.069979, 1000); 295 SetPositionFix(cell(), 3.5658700, 139.069979, 1000);
296 CheckLastPositionInfo(3.5658700, 139.069979, 1000); 296 CheckLastPositionInfo(3.5658700, 139.069979, 1000);
297 } 297 }
298 298
299 } // namespace content 299 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/geolocation/location_arbitrator_impl.cc ('k') | content/browser/geolocation/network_location_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698