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

Side by Side Diff: chrome/browser/extensions/api/identity/identity_apitest.cc

Issue 369353002: Create a FakeAccountReconcilor that doesn't perform network requests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/signin/fake_account_reconcilor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/extensions/api/identity/identity_api.h" 15 #include "chrome/browser/extensions/api/identity/identity_api.h"
16 #include "chrome/browser/extensions/component_loader.h" 16 #include "chrome/browser/extensions/component_loader.h"
17 #include "chrome/browser/extensions/extension_apitest.h" 17 #include "chrome/browser/extensions/extension_apitest.h"
18 #include "chrome/browser/extensions/extension_browsertest.h" 18 #include "chrome/browser/extensions/extension_browsertest.h"
19 #include "chrome/browser/extensions/extension_function_test_utils.h" 19 #include "chrome/browser/extensions/extension_function_test_utils.h"
20 #include "chrome/browser/extensions/extension_service.h" 20 #include "chrome/browser/extensions/extension_service.h"
21 #include "chrome/browser/guest_view/guest_view_base.h" 21 #include "chrome/browser/guest_view/guest_view_base.h"
22 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/signin/account_reconcilor_factory.h"
24 #include "chrome/browser/signin/fake_account_reconcilor.h"
23 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" 25 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
24 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" 26 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h"
25 #include "chrome/browser/signin/fake_signin_manager.h" 27 #include "chrome/browser/signin/fake_signin_manager.h"
26 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 28 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
27 #include "chrome/browser/signin/signin_manager_factory.h" 29 #include "chrome/browser/signin/signin_manager_factory.h"
28 #include "chrome/browser/ui/browser.h" 30 #include "chrome/browser/ui/browser.h"
29 #include "chrome/browser/ui/browser_window.h" 31 #include "chrome/browser/ui/browser_window.h"
30 #include "chrome/common/chrome_switches.h" 32 #include "chrome/common/chrome_switches.h"
31 #include "chrome/common/extensions/api/identity.h" 33 #include "chrome/common/extensions/api/identity.h"
32 #include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h" 34 #include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h"
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 } 675 }
674 676
675 void OnWillCreateBrowserContextServices(content::BrowserContext* context) { 677 void OnWillCreateBrowserContextServices(content::BrowserContext* context) {
676 // Replace the signin manager and token service with fakes. Do this ahead of 678 // Replace the signin manager and token service with fakes. Do this ahead of
677 // creating the browser so that a bunch of classes don't register as 679 // creating the browser so that a bunch of classes don't register as
678 // observers and end up needing to unregister when the fake is substituted. 680 // observers and end up needing to unregister when the fake is substituted.
679 SigninManagerFactory::GetInstance()->SetTestingFactory( 681 SigninManagerFactory::GetInstance()->SetTestingFactory(
680 context, &FakeSigninManagerBase::Build); 682 context, &FakeSigninManagerBase::Build);
681 ProfileOAuth2TokenServiceFactory::GetInstance()->SetTestingFactory( 683 ProfileOAuth2TokenServiceFactory::GetInstance()->SetTestingFactory(
682 context, &BuildFakeProfileOAuth2TokenService); 684 context, &BuildFakeProfileOAuth2TokenService);
685 AccountReconcilorFactory::GetInstance()->SetTestingFactory(
686 context, &FakeAccountReconcilor::Build);
683 } 687 }
684 688
685 virtual void SetUpOnMainThread() OVERRIDE { 689 virtual void SetUpOnMainThread() OVERRIDE {
686 AsyncExtensionBrowserTest::SetUpOnMainThread(); 690 AsyncExtensionBrowserTest::SetUpOnMainThread();
687 691
688 // Grab references to the fake signin manager and token service. 692 // Grab references to the fake signin manager and token service.
689 signin_manager_ = static_cast<FakeSigninManagerForTesting*>( 693 signin_manager_ = static_cast<FakeSigninManagerForTesting*>(
690 SigninManagerFactory::GetInstance()->GetForProfile(profile())); 694 SigninManagerFactory::GetInstance()->GetForProfile(profile()));
691 ASSERT_TRUE(signin_manager_); 695 ASSERT_TRUE(signin_manager_);
692 token_service_ = static_cast<FakeProfileOAuth2TokenService*>( 696 token_service_ = static_cast<FakeProfileOAuth2TokenService*>(
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), 1893 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"),
1890 url); 1894 url);
1891 } 1895 }
1892 1896
1893 } // namespace extensions 1897 } // namespace extensions
1894 1898
1895 // Tests the chrome.identity API implemented by custom JS bindings . 1899 // Tests the chrome.identity API implemented by custom JS bindings .
1896 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeIdentityJsBindings) { 1900 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeIdentityJsBindings) {
1897 ASSERT_TRUE(RunExtensionTest("identity/js_bindings")) << message_; 1901 ASSERT_TRUE(RunExtensionTest("identity/js_bindings")) << message_;
1898 } 1902 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/signin/fake_account_reconcilor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698