1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/browser/geolocation/fake_access_token_store.h"
8 #include "base/location.h"
9 #include "base/logging.h"
10 #include "base/message_loop/message_loop_proxy.h"
12 using base::MessageLoopProxy
;
14 using testing::Invoke
;
18 FakeAccessTokenStore::FakeAccessTokenStore()
19 : originating_message_loop_(NULL
) {
20 ON_CALL(*this, LoadAccessTokens(_
))
21 .WillByDefault(Invoke(this,
22 &FakeAccessTokenStore::DefaultLoadAccessTokens
));
23 ON_CALL(*this, SaveAccessToken(_
, _
))
24 .WillByDefault(Invoke(this,
25 &FakeAccessTokenStore::DefaultSaveAccessToken
));
28 void FakeAccessTokenStore::NotifyDelegateTokensLoaded() {
29 DCHECK(originating_message_loop_
);
30 if (!originating_message_loop_
->BelongsToCurrentThread()) {
31 originating_message_loop_
->PostTask(
33 base::Bind(&FakeAccessTokenStore::NotifyDelegateTokensLoaded
, this));
37 net::URLRequestContextGetter
* context_getter
= NULL
;
38 callback_
.Run(access_token_set_
, context_getter
);
41 void FakeAccessTokenStore::DefaultLoadAccessTokens(
42 const LoadAccessTokensCallbackType
& callback
) {
43 originating_message_loop_
= MessageLoopProxy::current().get();
47 void FakeAccessTokenStore::DefaultSaveAccessToken(
48 const GURL
& server_url
, const base::string16
& access_token
) {
49 DCHECK(server_url
.is_valid());
50 access_token_set_
[server_url
] = access_token
;
53 FakeAccessTokenStore::~FakeAccessTokenStore() {}
55 } // namespace content