Update V8 to version 3.29.50 (based on bleeding_edge revision r23756).
[chromium-blink-merge.git] / content / browser / geolocation / fake_access_token_store.cc
blob0e5fe4012895631894b20593f8fb6912606885cc
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"
7 #include "base/bind.h"
8 #include "base/location.h"
9 #include "base/logging.h"
10 #include "base/message_loop/message_loop_proxy.h"
12 using base::MessageLoopProxy;
13 using testing::_;
14 using testing::Invoke;
16 namespace content {
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(
32 FROM_HERE,
33 base::Bind(&FakeAccessTokenStore::NotifyDelegateTokensLoaded, this));
34 return;
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();
44 callback_ = callback;
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