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

Unified 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: Fixes up tests. 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 side-by-side diff with in-line comments
Download patch
Index: blimp/client/core/geolocation/geolocation_feature_unittest.cc
diff --git a/blimp/client/core/geolocation/geolocation_feature_unittest.cc b/blimp/client/core/geolocation/geolocation_feature_unittest.cc
index c268933b9e0013856b4c935fc2a1064e6ef8dd63..efd367952f77b4d4e4ae092da73c7adc28dd8106 100644
--- a/blimp/client/core/geolocation/geolocation_feature_unittest.cc
+++ b/blimp/client/core/geolocation/geolocation_feature_unittest.cc
@@ -21,6 +21,7 @@
using testing::InSequence;
using testing::Invoke;
+using testing::ReturnRef;
using testing::SaveArg;
using testing::StrictMock;
using testing::_;
@@ -179,6 +180,8 @@ TEST_F(GeolocationFeatureTest, ErrorUpdateSendsCorrectMessage) {
EXPECT_CALL(
*out_processor_,
MockableProcessMessage(EqualsError(GeolocationErrorMessage::TIMEOUT), _));
+ EXPECT_CALL(*location_provider_, GetPosition()).Times(3)
+ .WillRepeatedly(ReturnRef(position_));
device::Geoposition err_position;
err_position.error_code =
@@ -207,11 +210,15 @@ TEST_F(GeolocationFeatureTest, MessageSendsAfterAcknowledgement) {
.WillOnce(Invoke(
this, &GeolocationFeatureTest_MessageSendsAfterAcknowledgement_Test::
ReportProcessMessageSuccess));
+
device::Geoposition position;
position.latitude = 1.0;
position.longitude = 1.0;
position.altitude = 1.0;
position.accuracy = 1.0;
+ position.timestamp = base::Time::Now();
+ EXPECT_CALL(*location_provider_, GetPosition()).WillOnce(ReturnRef(position));
+
EXPECT_CALL(*out_processor_,
MockableProcessMessage(EqualGeoposition(1.0, 1.0, 1.0, 1.0), _));
callback_.Run(location_provider_, position_);

Powered by Google App Engine
This is Rietveld 408576698