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

Side by Side Diff: blimp/client/core/geolocation/geolocation_feature_unittest.cc

Issue 2331513002: Checks to see if the position is valid before OnLocationUpdate call. (Closed)
Patch Set: Tidy up. Created 4 years, 3 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
« no previous file with comments | « blimp/client/core/geolocation/geolocation_feature.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "blimp/client/core/geolocation/geolocation_feature.h" 5 #include "blimp/client/core/geolocation/geolocation_feature.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 callback_.Run(location_provider_, position_); 200 callback_.Run(location_provider_, position_);
201 callback_.Run(location_provider_, position_); 201 callback_.Run(location_provider_, position_);
202 } 202 }
203 203
204 TEST_F(GeolocationFeatureTest, MessageSendsAfterAcknowledgement) { 204 TEST_F(GeolocationFeatureTest, MessageSendsAfterAcknowledgement) {
205 EXPECT_CALL(*out_processor_, 205 EXPECT_CALL(*out_processor_,
206 MockableProcessMessage(EqualsDefaultGeoposition(), _)) 206 MockableProcessMessage(EqualsDefaultGeoposition(), _))
207 .WillOnce(Invoke( 207 .WillOnce(Invoke(
208 this, &GeolocationFeatureTest_MessageSendsAfterAcknowledgement_Test:: 208 this, &GeolocationFeatureTest_MessageSendsAfterAcknowledgement_Test::
209 ReportProcessMessageSuccess)); 209 ReportProcessMessageSuccess));
210
210 device::Geoposition position; 211 device::Geoposition position;
211 position.latitude = 1.0; 212 position.latitude = 1.0;
212 position.longitude = 1.0; 213 position.longitude = 1.0;
213 position.altitude = 1.0; 214 position.altitude = 1.0;
214 position.accuracy = 1.0; 215 position.accuracy = 1.0;
216 position.timestamp = base::Time::Now();
217
215 EXPECT_CALL(*out_processor_, 218 EXPECT_CALL(*out_processor_,
216 MockableProcessMessage(EqualGeoposition(1.0, 1.0, 1.0, 1.0), _)); 219 MockableProcessMessage(EqualGeoposition(1.0, 1.0, 1.0, 1.0), _));
217 callback_.Run(location_provider_, position_); 220 callback_.Run(location_provider_, position_);
218 callback_.Run(location_provider_, position); 221 callback_.Run(location_provider_, position);
219 } 222 }
220 223
221 TEST_F(GeolocationFeatureTest, ProcessMessageHandlesNullCallback) { 224 TEST_F(GeolocationFeatureTest, ProcessMessageHandlesNullCallback) {
222 EXPECT_CALL(*location_provider_, OnPermissionGranted()); 225 EXPECT_CALL(*location_provider_, OnPermissionGranted());
223 226
224 GeolocationMessage* geolocation_message; 227 GeolocationMessage* geolocation_message;
225 std::unique_ptr<BlimpMessage> message = 228 std::unique_ptr<BlimpMessage> message =
226 CreateBlimpMessage(&geolocation_message); 229 CreateBlimpMessage(&geolocation_message);
227 geolocation_message->mutable_request_refresh(); 230 geolocation_message->mutable_request_refresh();
228 231
229 feature_->ProcessMessage(std::move(message), net::CompletionCallback()); 232 feature_->ProcessMessage(std::move(message), net::CompletionCallback());
230 } 233 }
231 234
232 } // namespace client 235 } // namespace client
233 } // namespace blimp 236 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/client/core/geolocation/geolocation_feature.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698