OLD | NEW |
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 <utility> |
7 #include <vector> | 8 #include <vector> |
8 | 9 |
9 #include "base/command_line.h" | 10 #include "base/command_line.h" |
10 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
11 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
12 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
13 #include "base/values.h" | 14 #include "base/values.h" |
14 #include "build/build_config.h" | 15 #include "build/build_config.h" |
15 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
16 #if defined(OS_CHROMEOS) | 17 #if defined(OS_CHROMEOS) |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 login_access_token_result_ = result; | 300 login_access_token_result_ = result; |
300 } | 301 } |
301 | 302 |
302 void set_auto_login_access_token(bool automatic) { | 303 void set_auto_login_access_token(bool automatic) { |
303 auto_login_access_token_ = automatic; | 304 auto_login_access_token_ = automatic; |
304 } | 305 } |
305 | 306 |
306 void set_login_ui_result(bool result) { login_ui_result_ = result; } | 307 void set_login_ui_result(bool result) { login_ui_result_ = result; } |
307 | 308 |
308 void set_mint_token_flow(scoped_ptr<OAuth2MintTokenFlow> flow) { | 309 void set_mint_token_flow(scoped_ptr<OAuth2MintTokenFlow> flow) { |
309 flow_ = flow.Pass(); | 310 flow_ = std::move(flow); |
310 } | 311 } |
311 | 312 |
312 void set_mint_token_result(TestOAuth2MintTokenFlow::ResultType result_type) { | 313 void set_mint_token_result(TestOAuth2MintTokenFlow::ResultType result_type) { |
313 set_mint_token_flow( | 314 set_mint_token_flow( |
314 make_scoped_ptr(new TestOAuth2MintTokenFlow(result_type, this))); | 315 make_scoped_ptr(new TestOAuth2MintTokenFlow(result_type, this))); |
315 } | 316 } |
316 | 317 |
317 void set_scope_ui_failure(GaiaWebAuthFlow::Failure failure) { | 318 void set_scope_ui_failure(GaiaWebAuthFlow::Failure failure) { |
318 scope_ui_result_ = false; | 319 scope_ui_result_ = false; |
319 scope_ui_failure_ = failure; | 320 scope_ui_failure_ = failure; |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 } | 553 } |
553 | 554 |
554 class IdentityTestWithSignin : public AsyncExtensionBrowserTest { | 555 class IdentityTestWithSignin : public AsyncExtensionBrowserTest { |
555 public: | 556 public: |
556 void SetUpInProcessBrowserTestFixture() override { | 557 void SetUpInProcessBrowserTestFixture() override { |
557 AsyncExtensionBrowserTest::SetUpInProcessBrowserTestFixture(); | 558 AsyncExtensionBrowserTest::SetUpInProcessBrowserTestFixture(); |
558 | 559 |
559 will_create_browser_context_services_subscription_ = | 560 will_create_browser_context_services_subscription_ = |
560 BrowserContextDependencyManager::GetInstance() | 561 BrowserContextDependencyManager::GetInstance() |
561 ->RegisterWillCreateBrowserContextServicesCallbackForTesting( | 562 ->RegisterWillCreateBrowserContextServicesCallbackForTesting( |
562 base::Bind(&IdentityTestWithSignin:: | 563 base::Bind( |
563 OnWillCreateBrowserContextServices, | 564 &IdentityTestWithSignin::OnWillCreateBrowserContextServices, |
564 base::Unretained(this))) | 565 base::Unretained(this))); |
565 .Pass(); | |
566 } | 566 } |
567 | 567 |
568 void OnWillCreateBrowserContextServices(content::BrowserContext* context) { | 568 void OnWillCreateBrowserContextServices(content::BrowserContext* context) { |
569 // Replace the signin manager and token service with fakes. Do this ahead of | 569 // Replace the signin manager and token service with fakes. Do this ahead of |
570 // creating the browser so that a bunch of classes don't register as | 570 // creating the browser so that a bunch of classes don't register as |
571 // observers and end up needing to unregister when the fake is substituted. | 571 // observers and end up needing to unregister when the fake is substituted. |
572 SigninManagerFactory::GetInstance()->SetTestingFactory( | 572 SigninManagerFactory::GetInstance()->SetTestingFactory( |
573 context, &BuildFakeSigninManagerBase); | 573 context, &BuildFakeSigninManagerBase); |
574 ProfileOAuth2TokenServiceFactory::GetInstance()->SetTestingFactory( | 574 ProfileOAuth2TokenServiceFactory::GetInstance()->SetTestingFactory( |
575 context, &BuildFakeProfileOAuth2TokenService); | 575 context, &BuildFakeProfileOAuth2TokenService); |
(...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1921 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), | 1921 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), |
1922 url); | 1922 url); |
1923 } | 1923 } |
1924 | 1924 |
1925 } // namespace extensions | 1925 } // namespace extensions |
1926 | 1926 |
1927 // Tests the chrome.identity API implemented by custom JS bindings . | 1927 // Tests the chrome.identity API implemented by custom JS bindings . |
1928 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeIdentityJsBindings) { | 1928 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeIdentityJsBindings) { |
1929 ASSERT_TRUE(RunExtensionTest("identity/js_bindings")) << message_; | 1929 ASSERT_TRUE(RunExtensionTest("identity/js_bindings")) << message_; |
1930 } | 1930 } |
OLD | NEW |