summaryrefslogtreecommitdiffstats
path: root/chrome/browser/geolocation/fake_access_token_store.cc
blob: 186543621503c5c72c23bf71ffe4da8abb9db4ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/geolocation/fake_access_token_store.h"

FakeAccessTokenStore::FakeAccessTokenStore() {}

void FakeAccessTokenStore::NotifyDelegateTokensLoaded() {
  CHECK(request_ != NULL);
  request_->ForwardResult(MakeTuple(access_token_set_));
  request_ = NULL;
}

void FakeAccessTokenStore::DoLoadAccessTokens(
    scoped_refptr<CancelableRequest<LoadAccessTokensCallbackType> > request) {
  DCHECK(request_ == NULL)
      << "Fake token store currently only allows one request at a time";
  request_ = request;
}

void FakeAccessTokenStore::SaveAccessToken(
    const GURL& server_url, const string16& access_token) {
  DCHECK(server_url.is_valid());
  access_token_set_[server_url] = access_token;
}

FakeAccessTokenStore::~FakeAccessTokenStore() {}