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

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

Issue 2257113002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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
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 <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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 } 306 }
307 307
308 void set_login_ui_result(bool result) { login_ui_result_ = result; } 308 void set_login_ui_result(bool result) { login_ui_result_ = result; }
309 309
310 void set_mint_token_flow(std::unique_ptr<OAuth2MintTokenFlow> flow) { 310 void set_mint_token_flow(std::unique_ptr<OAuth2MintTokenFlow> flow) {
311 flow_ = std::move(flow); 311 flow_ = std::move(flow);
312 } 312 }
313 313
314 void set_mint_token_result(TestOAuth2MintTokenFlow::ResultType result_type) { 314 void set_mint_token_result(TestOAuth2MintTokenFlow::ResultType result_type) {
315 set_mint_token_flow( 315 set_mint_token_flow(
316 base::WrapUnique(new TestOAuth2MintTokenFlow(result_type, this))); 316 base::MakeUnique<TestOAuth2MintTokenFlow>(result_type, this));
317 } 317 }
318 318
319 void set_scope_ui_failure(GaiaWebAuthFlow::Failure failure) { 319 void set_scope_ui_failure(GaiaWebAuthFlow::Failure failure) {
320 scope_ui_result_ = false; 320 scope_ui_result_ = false;
321 scope_ui_failure_ = failure; 321 scope_ui_failure_ = failure;
322 } 322 }
323 323
324 void set_scope_ui_oauth_error(const std::string& oauth_error) { 324 void set_scope_ui_oauth_error(const std::string& oauth_error) {
325 scope_ui_result_ = false; 325 scope_ui_result_ = false;
326 scope_ui_failure_ = GaiaWebAuthFlow::OAUTH_ERROR; 326 scope_ui_failure_ = GaiaWebAuthFlow::OAUTH_ERROR;
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 1242
1243 QueueRequestComplete(type, &queued_request); 1243 QueueRequestComplete(type, &queued_request);
1244 } 1244 }
1245 1245
1246 IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, NoninteractiveShutdown) { 1246 IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, NoninteractiveShutdown) {
1247 SignIn("primary@example.com"); 1247 SignIn("primary@example.com");
1248 scoped_refptr<const Extension> extension(CreateExtension(CLIENT_ID | SCOPES)); 1248 scoped_refptr<const Extension> extension(CreateExtension(CLIENT_ID | SCOPES));
1249 scoped_refptr<FakeGetAuthTokenFunction> func(new FakeGetAuthTokenFunction()); 1249 scoped_refptr<FakeGetAuthTokenFunction> func(new FakeGetAuthTokenFunction());
1250 func->set_extension(extension.get()); 1250 func->set_extension(extension.get());
1251 1251
1252 func->set_mint_token_flow( 1252 func->set_mint_token_flow(base::MakeUnique<TestHangOAuth2MintTokenFlow>());
1253 base::WrapUnique(new TestHangOAuth2MintTokenFlow()));
1254 RunFunctionAsync(func.get(), "[{\"interactive\": false}]"); 1253 RunFunctionAsync(func.get(), "[{\"interactive\": false}]");
1255 1254
1256 // After the request is canceled, the function will complete. 1255 // After the request is canceled, the function will complete.
1257 func->OnShutdown(); 1256 func->OnShutdown();
1258 EXPECT_EQ(std::string(errors::kCanceled), WaitForError(func.get())); 1257 EXPECT_EQ(std::string(errors::kCanceled), WaitForError(func.get()));
1259 } 1258 }
1260 1259
1261 IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest, 1260 IN_PROC_BROWSER_TEST_F(GetAuthTokenFunctionTest,
1262 InteractiveQueuedNoninteractiveFails) { 1261 InteractiveQueuedNoninteractiveFails) {
1263 SignIn("primary@example.com"); 1262 SignIn("primary@example.com");
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), 1898 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"),
1900 url); 1899 url);
1901 } 1900 }
1902 1901
1903 } // namespace extensions 1902 } // namespace extensions
1904 1903
1905 // Tests the chrome.identity API implemented by custom JS bindings . 1904 // Tests the chrome.identity API implemented by custom JS bindings .
1906 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeIdentityJsBindings) { 1905 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeIdentityJsBindings) {
1907 ASSERT_TRUE(RunExtensionTest("identity/js_bindings")) << message_; 1906 ASSERT_TRUE(RunExtensionTest("identity/js_bindings")) << message_;
1908 } 1907 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698