| 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 <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" |
| (...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 func->set_login_access_token_result(false); | 957 func->set_login_access_token_result(false); |
| 958 std::string error = utils::RunFunctionAndReturnError( | 958 std::string error = utils::RunFunctionAndReturnError( |
| 959 func.get(), "[{\"interactive\": true}]", browser()); | 959 func.get(), "[{\"interactive\": true}]", browser()); |
| 960 EXPECT_TRUE(StartsWithASCII(error, errors::kAuthFailure, false)); | 960 EXPECT_TRUE(StartsWithASCII(error, errors::kAuthFailure, false)); |
| 961 EXPECT_TRUE(func->login_ui_shown()); | 961 EXPECT_TRUE(func->login_ui_shown()); |
| 962 EXPECT_FALSE(func->scope_ui_shown()); | 962 EXPECT_FALSE(func->scope_ui_shown()); |
| 963 } | 963 } |
| 964 | 964 |
| 965 IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, | 965 IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, |
| 966 InteractiveLoginSuccessMintSuccess) { | 966 InteractiveLoginSuccessMintSuccess) { |
| 967 // TODO(courage): verify that account_id in token service requests |
| 968 // is correct once manual token minting for tests is implemented. |
| 967 scoped_refptr<FakeGetAuthTokenFunction> func(new FakeGetAuthTokenFunction()); | 969 scoped_refptr<FakeGetAuthTokenFunction> func(new FakeGetAuthTokenFunction()); |
| 968 func->set_extension(CreateExtension(CLIENT_ID | SCOPES)); | 970 func->set_extension(CreateExtension(CLIENT_ID | SCOPES)); |
| 969 func->set_login_ui_result(true); | 971 func->set_login_ui_result(true); |
| 970 func->set_mint_token_result(TestOAuth2MintTokenFlow::MINT_TOKEN_SUCCESS); | 972 func->set_mint_token_result(TestOAuth2MintTokenFlow::MINT_TOKEN_SUCCESS); |
| 971 scoped_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult( | 973 scoped_ptr<base::Value> value(utils::RunFunctionAndReturnSingleResult( |
| 972 func.get(), "[{\"interactive\": true}]", browser())); | 974 func.get(), "[{\"interactive\": true}]", browser())); |
| 973 std::string access_token; | 975 std::string access_token; |
| 974 EXPECT_TRUE(value->GetAsString(&access_token)); | 976 EXPECT_TRUE(value->GetAsString(&access_token)); |
| 975 EXPECT_EQ(std::string(kAccessToken), access_token); | 977 EXPECT_EQ(std::string(kAccessToken), access_token); |
| 976 EXPECT_TRUE(func->login_ui_shown()); | 978 EXPECT_TRUE(func->login_ui_shown()); |
| (...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1818 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), | 1820 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), |
| 1819 url); | 1821 url); |
| 1820 } | 1822 } |
| 1821 | 1823 |
| 1822 } // namespace extensions | 1824 } // namespace extensions |
| 1823 | 1825 |
| 1824 // Tests the chrome.identity API implemented by custom JS bindings . | 1826 // Tests the chrome.identity API implemented by custom JS bindings . |
| 1825 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeIdentityJsBindings) { | 1827 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeIdentityJsBindings) { |
| 1826 ASSERT_TRUE(RunExtensionTest("identity/js_bindings")) << message_; | 1828 ASSERT_TRUE(RunExtensionTest("identity/js_bindings")) << message_; |
| 1827 } | 1829 } |
| OLD | NEW |