| 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 <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 | 1187 |
| 1188 // The real request will start processing, but wait in the queue behind | 1188 // The real request will start processing, but wait in the queue behind |
| 1189 // the blocker. | 1189 // the blocker. |
| 1190 func->set_mint_token_result(TestOAuth2MintTokenFlow::ISSUE_ADVICE_SUCCESS); | 1190 func->set_mint_token_result(TestOAuth2MintTokenFlow::ISSUE_ADVICE_SUCCESS); |
| 1191 RunFunctionAsync(func.get(), "[{\"interactive\": true}]"); | 1191 RunFunctionAsync(func.get(), "[{\"interactive\": true}]"); |
| 1192 // Verify that we have fetched the login token and run the first flow. | 1192 // Verify that we have fetched the login token and run the first flow. |
| 1193 testing::Mock::VerifyAndClearExpectations(func.get()); | 1193 testing::Mock::VerifyAndClearExpectations(func.get()); |
| 1194 EXPECT_FALSE(func->scope_ui_shown()); | 1194 EXPECT_FALSE(func->scope_ui_shown()); |
| 1195 | 1195 |
| 1196 // After the request is canceled, the function will complete. | 1196 // After the request is canceled, the function will complete. |
| 1197 func->OnShutdown(); | 1197 func->Shutdown(); |
| 1198 EXPECT_EQ(std::string(errors::kCanceled), WaitForError(func.get())); | 1198 EXPECT_EQ(std::string(errors::kCanceled), WaitForError(func.get())); |
| 1199 EXPECT_FALSE(func->login_ui_shown()); | 1199 EXPECT_FALSE(func->login_ui_shown()); |
| 1200 EXPECT_FALSE(func->scope_ui_shown()); | 1200 EXPECT_FALSE(func->scope_ui_shown()); |
| 1201 | 1201 |
| 1202 QueueRequestComplete(type, &queued_request); | 1202 QueueRequestComplete(type, &queued_request); |
| 1203 } | 1203 } |
| 1204 | 1204 |
| 1205 IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, NoninteractiveShutdown) { | 1205 IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, NoninteractiveShutdown) { |
| 1206 SignIn("primary@example.com"); | 1206 SignIn("primary@example.com"); |
| 1207 scoped_refptr<const Extension> extension(CreateExtension(CLIENT_ID | SCOPES)); | 1207 scoped_refptr<const Extension> extension(CreateExtension(CLIENT_ID | SCOPES)); |
| 1208 scoped_refptr<FakeGetAuthTokenFunction> func(new FakeGetAuthTokenFunction()); | 1208 scoped_refptr<FakeGetAuthTokenFunction> func(new FakeGetAuthTokenFunction()); |
| 1209 func->set_extension(extension.get()); | 1209 func->set_extension(extension.get()); |
| 1210 | 1210 |
| 1211 func->set_mint_token_flow(base::MakeUnique<TestHangOAuth2MintTokenFlow>()); | 1211 func->set_mint_token_flow(base::MakeUnique<TestHangOAuth2MintTokenFlow>()); |
| 1212 RunFunctionAsync(func.get(), "[{\"interactive\": false}]"); | 1212 RunFunctionAsync(func.get(), "[{\"interactive\": false}]"); |
| 1213 | 1213 |
| 1214 // After the request is canceled, the function will complete. | 1214 // After the request is canceled, the function will complete. |
| 1215 func->OnShutdown(); | 1215 func->Shutdown(); |
| 1216 EXPECT_EQ(std::string(errors::kCanceled), WaitForError(func.get())); | 1216 EXPECT_EQ(std::string(errors::kCanceled), WaitForError(func.get())); |
| 1217 } | 1217 } |
| 1218 | 1218 |
| 1219 IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, | 1219 IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, |
| 1220 InteractiveQueuedNoninteractiveFails) { | 1220 InteractiveQueuedNoninteractiveFails) { |
| 1221 SignIn("primary@example.com"); | 1221 SignIn("primary@example.com"); |
| 1222 scoped_refptr<const Extension> extension(CreateExtension(CLIENT_ID | SCOPES)); | 1222 scoped_refptr<const Extension> extension(CreateExtension(CLIENT_ID | SCOPES)); |
| 1223 scoped_refptr<FakeGetAuthTokenFunction> func(new FakeGetAuthTokenFunction()); | 1223 scoped_refptr<FakeGetAuthTokenFunction> func(new FakeGetAuthTokenFunction()); |
| 1224 func->set_extension(extension.get()); | 1224 func->set_extension(extension.get()); |
| 1225 | 1225 |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1856 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), | 1856 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), |
| 1857 url); | 1857 url); |
| 1858 } | 1858 } |
| 1859 | 1859 |
| 1860 } // namespace extensions | 1860 } // namespace extensions |
| 1861 | 1861 |
| 1862 // Tests the chrome.identity API implemented by custom JS bindings . | 1862 // Tests the chrome.identity API implemented by custom JS bindings . |
| 1863 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeIdentityJsBindings) { | 1863 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeIdentityJsBindings) { |
| 1864 ASSERT_TRUE(RunExtensionTest("identity/js_bindings")) << message_; | 1864 ASSERT_TRUE(RunExtensionTest("identity/js_bindings")) << message_; |
| 1865 } | 1865 } |
| OLD | NEW |