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

Unified Diff: device/geolocation/location_arbitrator_impl_unittest.cc

Issue 2226143002: Gets rid of the LocationArbitrator interface, in preference for LocationProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses kmarshall's #41 comments Created 4 years, 4 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: device/geolocation/location_arbitrator_impl_unittest.cc
diff --git a/device/geolocation/location_arbitrator_impl_unittest.cc b/device/geolocation/location_arbitrator_impl_unittest.cc
index 9e01f1181f12e7bb403cedafd81b928b49bc6539..25e1dd1ae2421c69722b380e53cb3d68fa4bbaef 100644
--- a/device/geolocation/location_arbitrator_impl_unittest.cc
+++ b/device/geolocation/location_arbitrator_impl_unittest.cc
@@ -5,6 +5,7 @@
#include "device/geolocation/location_arbitrator_impl.h"
#include <memory>
+#include <utility>
#include "base/bind.h"
#include "base/memory/ptr_util.h"
@@ -193,9 +194,9 @@ TEST_F(GeolocationLocationArbitratorTest, CreateDestroy) {
TEST_F(GeolocationLocationArbitratorTest, OnPermissionGranted) {
InitializeArbitrator(nullptr);
- EXPECT_FALSE(arbitrator_->HasPermissionBeenGranted());
+ EXPECT_FALSE(arbitrator_->HasPermissionBeenGrantedForTest());
arbitrator_->OnPermissionGranted();
- EXPECT_TRUE(arbitrator_->HasPermissionBeenGranted());
+ EXPECT_TRUE(arbitrator_->HasPermissionBeenGrantedForTest());
// Can't check the provider has been notified without going through the
// motions to create the provider (see next test).
EXPECT_FALSE(cell());
@@ -209,7 +210,7 @@ TEST_F(GeolocationLocationArbitratorTest, NormalUsage) {
EXPECT_FALSE(cell());
EXPECT_FALSE(gps());
- arbitrator_->StartProviders(false);
+ arbitrator_->StartProvider(false);
EXPECT_TRUE(access_token_store_->access_token_map_.empty());
@@ -229,9 +230,9 @@ TEST_F(GeolocationLocationArbitratorTest, NormalUsage) {
EXPECT_EQ(cell()->position_.latitude, observer_->last_position_.latitude);
EXPECT_FALSE(cell()->is_permission_granted_);
- EXPECT_FALSE(arbitrator_->HasPermissionBeenGranted());
+ EXPECT_FALSE(arbitrator_->HasPermissionBeenGrantedForTest());
arbitrator_->OnPermissionGranted();
- EXPECT_TRUE(arbitrator_->HasPermissionBeenGranted());
+ EXPECT_TRUE(arbitrator_->HasPermissionBeenGrantedForTest());
EXPECT_TRUE(cell()->is_permission_granted_);
}
@@ -245,7 +246,7 @@ TEST_F(GeolocationLocationArbitratorTest, CustomSystemProviderOnly) {
EXPECT_FALSE(cell());
EXPECT_FALSE(gps());
- arbitrator_->StartProviders(false);
+ arbitrator_->StartProvider(false);
ASSERT_FALSE(cell());
EXPECT_FALSE(gps());
@@ -264,9 +265,9 @@ TEST_F(GeolocationLocationArbitratorTest, CustomSystemProviderOnly) {
observer_->last_position_.latitude);
EXPECT_FALSE(fake_delegate->mock_location_provider()->is_permission_granted_);
- EXPECT_FALSE(arbitrator_->HasPermissionBeenGranted());
+ EXPECT_FALSE(arbitrator_->HasPermissionBeenGrantedForTest());
arbitrator_->OnPermissionGranted();
- EXPECT_TRUE(arbitrator_->HasPermissionBeenGranted());
+ EXPECT_TRUE(arbitrator_->HasPermissionBeenGrantedForTest());
EXPECT_TRUE(fake_delegate->mock_location_provider()->is_permission_granted_);
}
@@ -281,7 +282,7 @@ TEST_F(GeolocationLocationArbitratorTest,
EXPECT_FALSE(cell());
EXPECT_FALSE(gps());
- arbitrator_->StartProviders(false);
+ arbitrator_->StartProvider(false);
EXPECT_TRUE(access_token_store_->access_token_map_.empty());
@@ -304,15 +305,15 @@ TEST_F(GeolocationLocationArbitratorTest,
EXPECT_EQ(cell()->position_.latitude, observer_->last_position_.latitude);
EXPECT_FALSE(cell()->is_permission_granted_);
- EXPECT_FALSE(arbitrator_->HasPermissionBeenGranted());
+ EXPECT_FALSE(arbitrator_->HasPermissionBeenGrantedForTest());
arbitrator_->OnPermissionGranted();
- EXPECT_TRUE(arbitrator_->HasPermissionBeenGranted());
+ EXPECT_TRUE(arbitrator_->HasPermissionBeenGrantedForTest());
EXPECT_TRUE(cell()->is_permission_granted_);
}
TEST_F(GeolocationLocationArbitratorTest, SetObserverOptions) {
InitializeArbitrator(nullptr);
- arbitrator_->StartProviders(false);
+ arbitrator_->StartProvider(false);
access_token_store_->NotifyDelegateTokensLoaded();
ASSERT_TRUE(cell());
ASSERT_TRUE(gps());
@@ -321,14 +322,14 @@ TEST_F(GeolocationLocationArbitratorTest, SetObserverOptions) {
SetReferencePosition(cell());
EXPECT_EQ(MockLocationProvider::LOW_ACCURACY, cell()->state_);
EXPECT_EQ(MockLocationProvider::LOW_ACCURACY, gps()->state_);
- arbitrator_->StartProviders(true);
+ arbitrator_->StartProvider(true);
EXPECT_EQ(MockLocationProvider::HIGH_ACCURACY, cell()->state_);
EXPECT_EQ(MockLocationProvider::HIGH_ACCURACY, gps()->state_);
}
TEST_F(GeolocationLocationArbitratorTest, Arbitration) {
InitializeArbitrator(nullptr);
- arbitrator_->StartProviders(false);
+ arbitrator_->StartProvider(false);
access_token_store_->NotifyDelegateTokensLoaded();
ASSERT_TRUE(cell());
ASSERT_TRUE(gps());
@@ -405,7 +406,7 @@ TEST_F(GeolocationLocationArbitratorTest, Arbitration) {
TEST_F(GeolocationLocationArbitratorTest, TwoOneShotsIsNewPositionBetter) {
InitializeArbitrator(nullptr);
- arbitrator_->StartProviders(false);
+ arbitrator_->StartProvider(false);
access_token_store_->NotifyDelegateTokensLoaded();
ASSERT_TRUE(cell());
ASSERT_TRUE(gps());
@@ -415,14 +416,14 @@ TEST_F(GeolocationLocationArbitratorTest, TwoOneShotsIsNewPositionBetter) {
CheckLastPositionInfo(3, 139, 100);
// Restart providers to simulate a one-shot request.
- arbitrator_->StopProviders();
+ arbitrator_->StopProvider();
// To test 240956, perform a throwaway alloc.
// This convinces the allocator to put the providers in a new memory location.
std::unique_ptr<MockLocationProvider> dummy_provider(
new MockLocationProvider);
- arbitrator_->StartProviders(false);
+ arbitrator_->StartProvider(false);
access_token_store_->NotifyDelegateTokensLoaded();
// Advance the time a short while to simulate successive calls.

Powered by Google App Engine
This is Rietveld 408576698