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

Unified Diff: chrome/browser/geolocation/network_location_provider_unittest.cc

Issue 603040: Add support for top level geolocation arbitrator, and access token persistenc... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 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: chrome/browser/geolocation/network_location_provider_unittest.cc
===================================================================
--- chrome/browser/geolocation/network_location_provider_unittest.cc (revision 38890)
+++ chrome/browser/geolocation/network_location_provider_unittest.cc (working copy)
@@ -10,6 +10,7 @@
#include "base/scoped_ptr.h"
#include "base/string_util.h"
#include "base/values.h"
+#include "chrome/browser/geolocation/access_token_store.h"
#include "chrome/browser/net/test_url_fetcher_factory.h"
#include "net/url_request/url_request_status.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -45,7 +46,7 @@
LocationProviderBase* movement_provider_;
};
-class FakeAccessTokenStore : public LocationProviderBase::AccessTokenStore {
+class FakeAccessTokenStore : public AccessTokenStore {
public:
FakeAccessTokenStore() : allow_set_(true) {}
@@ -65,6 +66,9 @@
}
bool allow_set_;
std::map<GURL, string16> token_map_;
+
+ private:
+ ~FakeAccessTokenStore() {}
};
@@ -132,6 +136,7 @@
public:
virtual void SetUp() {
URLFetcher::set_factory(&url_fetcher_factory_);
+ access_token_store_ = new FakeAccessTokenStore;
}
virtual void TearDown() {
@@ -143,7 +148,7 @@
LocationProviderBase* CreateProvider() {
return NewNetworkLocationProvider(
- &access_token_store_,
+ access_token_store_.get(),
NULL, // No URLContextGetter needed, as using test urlfecther factory.
test_server_url_,
ASCIIToUTF16(kTestHost));
@@ -253,7 +258,7 @@
const GURL test_server_url_;
MessageLoop main_message_loop_;
- FakeAccessTokenStore access_token_store_;
+ scoped_refptr<FakeAccessTokenStore> access_token_store_;
TestURLFetcherFactory url_fetcher_factory_;
};
@@ -315,9 +320,9 @@
ResponseCookies(), kNoFixNetworkResponse);
// This should have set the access token anyhow
- EXPECT_EQ(1, static_cast<int>(access_token_store_.token_map_.size()));
+ EXPECT_EQ(1, static_cast<int>(access_token_store_->token_map_.size()));
string16 token;
- EXPECT_TRUE(access_token_store_.GetAccessToken(test_server_url_, &token));
+ EXPECT_TRUE(access_token_store_->GetAccessToken(test_server_url_, &token));
EXPECT_EQ(REFERENCE_ACCESS_TOKEN, UTF16ToUTF8(token));
Position position;
@@ -361,8 +366,8 @@
EXPECT_TRUE(position.IsValidFix());
// Token should still be in the store.
- EXPECT_EQ(1, static_cast<int>(access_token_store_.token_map_.size()));
- EXPECT_TRUE(access_token_store_.GetAccessToken(test_server_url_, &token));
+ EXPECT_EQ(1, static_cast<int>(access_token_store_->token_map_.size()));
+ EXPECT_TRUE(access_token_store_->GetAccessToken(test_server_url_, &token));
EXPECT_EQ(REFERENCE_ACCESS_TOKEN, UTF16ToUTF8(token));
// Wifi updated again, with one less AP. This is 'close enough' to the
« no previous file with comments | « chrome/browser/geolocation/network_location_provider.cc ('k') | chrome/browser/geolocation/network_location_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698