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

Unified Diff: content/browser/geolocation/gps_location_provider_unittest_linux.cc

Issue 10316007: Make the Geoposition helper class public (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix forward-declaration of struct as class. Created 8 years, 8 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: content/browser/geolocation/gps_location_provider_unittest_linux.cc
diff --git a/content/browser/geolocation/gps_location_provider_unittest_linux.cc b/content/browser/geolocation/gps_location_provider_unittest_linux.cc
index ea5f5bb26c512f0e3eed89308e83dcc2b07dc6e8..4a84c6ab5c1821b9e051e3d9a587306dc8442ded 100644
--- a/content/browser/geolocation/gps_location_provider_unittest_linux.cc
+++ b/content/browser/geolocation/gps_location_provider_unittest_linux.cc
@@ -18,7 +18,7 @@ class MockLibGps : public LibGps {
MockLibGps();
~MockLibGps();
- virtual bool GetPositionIfFixed(Geoposition* position) {
+ virtual bool GetPositionIfFixed(content::Geoposition* position) {
CHECK(position);
++get_position_calls_;
*position = get_position_;
@@ -47,7 +47,7 @@ class MockLibGps : public LibGps {
int gps_open_ret_;
int gps_read_calls_;
int gps_read_ret_;
- Geoposition get_position_;
+ content::Geoposition get_position_;
static MockLibGps* g_instance_;
};
@@ -78,9 +78,9 @@ class GeolocationGpsProviderLinuxTests : public testing::Test {
scoped_ptr<GpsLocationProviderLinux> provider_;
};
-void CheckValidPosition(const Geoposition& expected,
- const Geoposition& actual) {
- EXPECT_TRUE(actual.IsValidFix());
+void CheckValidPosition(const content::Geoposition& expected,
+ const content::Geoposition& actual) {
+ EXPECT_TRUE(actual.Validate());
EXPECT_DOUBLE_EQ(expected.latitude, actual.latitude);
EXPECT_DOUBLE_EQ(expected.longitude, actual.longitude);
EXPECT_DOUBLE_EQ(expected.accuracy, actual.accuracy);
@@ -96,7 +96,8 @@ MockLibGps::MockLibGps()
gps_open_ret_(0),
gps_read_calls_(0),
gps_read_ret_(0) {
- get_position_.error_code = Geoposition::ERROR_CODE_POSITION_UNAVAILABLE;
+ get_position_.error_code =
+ content::Geoposition::ERROR_CODE_POSITION_UNAVAILABLE;
EXPECT_FALSE(g_instance_);
g_instance_ = this;
}
@@ -121,11 +122,11 @@ TEST_F(GeolocationGpsProviderLinuxTests, NoLibGpsInstalled) {
ASSERT_TRUE(provider_.get());
const bool ok = provider_->StartProvider(true);
EXPECT_FALSE(ok);
- Geoposition position;
+ content::Geoposition position;
provider_->GetPosition(&position);
- EXPECT_TRUE(position.IsInitialized());
- EXPECT_FALSE(position.IsValidFix());
- EXPECT_EQ(Geoposition::ERROR_CODE_POSITION_UNAVAILABLE, position.error_code);
+ EXPECT_FALSE(position.Validate());
+ EXPECT_EQ(content::Geoposition::ERROR_CODE_POSITION_UNAVAILABLE,
+ position.error_code);
}
#if defined(OS_CHROMEOS)
@@ -138,19 +139,19 @@ TEST_F(GeolocationGpsProviderLinuxTests, GetPosition) {
EXPECT_EQ(0, MockLibGps::g_instance_->get_position_calls_);
EXPECT_EQ(0, MockLibGps::g_instance_->gps_open_calls_);
EXPECT_EQ(0, MockLibGps::g_instance_->gps_read_calls_);
- Geoposition position;
+ content::Geoposition position;
provider_->GetPosition(&position);
- EXPECT_TRUE(position.IsInitialized());
- EXPECT_FALSE(position.IsValidFix());
- EXPECT_EQ(Geoposition::ERROR_CODE_POSITION_UNAVAILABLE, position.error_code);
+ EXPECT_FALSE(position.Validate());
+ EXPECT_EQ(content::Geoposition::ERROR_CODE_POSITION_UNAVAILABLE,
+ position.error_code);
MockLibGps::g_instance_->get_position_.error_code =
- Geoposition::ERROR_CODE_NONE;
+ content::Geoposition::ERROR_CODE_NONE;
MockLibGps::g_instance_->get_position_.latitude = 4.5;
MockLibGps::g_instance_->get_position_.longitude = -34.1;
MockLibGps::g_instance_->get_position_.accuracy = 345;
MockLibGps::g_instance_->get_position_.timestamp =
base::Time::FromDoubleT(200);
- EXPECT_TRUE(MockLibGps::g_instance_->get_position_.IsValidFix());
+ EXPECT_TRUE(MockLibGps::g_instance_->get_position_.Validate());
MessageLoop::current()->Run();
EXPECT_EQ(1, MockLibGps::g_instance_->get_position_calls_);
EXPECT_EQ(1, MockLibGps::g_instance_->gps_open_calls_);
@@ -183,15 +184,15 @@ TEST_F(GeolocationGpsProviderLinuxTests, LibGpsReconnect) {
// Let gps_open() fails, and so will LibGps::Start().
// Reconnect will happen in 1000ms.
MockLibGps::g_instance_->gps_open_ret_ = 1;
- Geoposition position;
+ content::Geoposition position;
MockLibGps::g_instance_->get_position_.error_code =
- Geoposition::ERROR_CODE_NONE;
+ content::Geoposition::ERROR_CODE_NONE;
MockLibGps::g_instance_->get_position_.latitude = 4.5;
MockLibGps::g_instance_->get_position_.longitude = -34.1;
MockLibGps::g_instance_->get_position_.accuracy = 345;
MockLibGps::g_instance_->get_position_.timestamp =
base::Time::FromDoubleT(200);
- EXPECT_TRUE(MockLibGps::g_instance_->get_position_.IsValidFix());
+ EXPECT_TRUE(MockLibGps::g_instance_->get_position_.Validate());
// This task makes gps_open() and LibGps::Start() to succeed after
// 1500ms.
MessageLoop::current()->PostDelayedTask(
@@ -200,8 +201,7 @@ TEST_F(GeolocationGpsProviderLinuxTests, LibGpsReconnect) {
base::TimeDelta::FromMilliseconds(1500));
MessageLoop::current()->Run();
provider_->GetPosition(&position);
- EXPECT_TRUE(position.IsInitialized());
- EXPECT_TRUE(position.IsValidFix());
+ EXPECT_TRUE(position.Validate());
// 3 gps_open() calls are expected (2 failures and 1 success)
EXPECT_EQ(1, MockLibGps::g_instance_->get_position_calls_);
EXPECT_EQ(3, MockLibGps::g_instance_->gps_open_calls_);
« no previous file with comments | « content/browser/geolocation/gps_location_provider_linux.cc ('k') | content/browser/geolocation/libgps_wrapper_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698