1 // Copyright (c) 2012 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 #ifndef CONTENT_BROWSER_GEOLOCATION_FAKE_ACCESS_TOKEN_STORE_H_
6 #define CONTENT_BROWSER_GEOLOCATION_FAKE_ACCESS_TOKEN_STORE_H_
8 #include "base/message_loop/message_loop_proxy.h"
9 #include "content/public/browser/access_token_store.h"
10 #include "testing/gmock/include/gmock/gmock.h"
11 #include "testing/gtest/include/gtest/gtest.h"
15 // A fake (non-persisted) access token store instance useful for testing.
16 class FakeAccessTokenStore
: public AccessTokenStore
{
18 FakeAccessTokenStore();
20 void NotifyDelegateTokensLoaded();
23 MOCK_METHOD1(LoadAccessTokens
,
24 void(const LoadAccessTokensCallbackType
& callback
));
25 MOCK_METHOD2(SaveAccessToken
,
26 void(const GURL
& server_url
,
27 const base::string16
& access_token
));
29 void DefaultLoadAccessTokens(const LoadAccessTokensCallbackType
& callback
);
31 void DefaultSaveAccessToken(const GURL
& server_url
,
32 const base::string16
& access_token
);
34 AccessTokenSet access_token_set_
;
35 LoadAccessTokensCallbackType callback_
;
38 // Protected instead of private so we can have NiceMocks.
39 virtual ~FakeAccessTokenStore();
42 // In some tests, NotifyDelegateTokensLoaded() is called on a thread
43 // other than the originating thread, in which case we must post
45 base::MessageLoopProxy
* originating_message_loop_
;
47 DISALLOW_COPY_AND_ASSIGN(FakeAccessTokenStore
);
50 } // namespace content
52 #endif // CONTENT_BROWSER_GEOLOCATION_FAKE_ACCESS_TOKEN_STORE_H_