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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 | 415 |
416 const base::ListValue* results; | 416 const base::ListValue* results; |
417 if (!callback_arguments->GetList(0, &results)) | 417 if (!callback_arguments->GetList(0, &results)) |
418 GenerateFailureResult(accounts, NULL) << "Result was not an array"; | 418 GenerateFailureResult(accounts, NULL) << "Result was not an array"; |
419 | 419 |
420 std::set<std::string> result_ids; | 420 std::set<std::string> result_ids; |
421 for (base::ListValue::const_iterator it = results->begin(); | 421 for (base::ListValue::const_iterator it = results->begin(); |
422 it != results->end(); | 422 it != results->end(); |
423 ++it) { | 423 ++it) { |
424 std::unique_ptr<api::identity::AccountInfo> info = | 424 std::unique_ptr<api::identity::AccountInfo> info = |
425 api::identity::AccountInfo::FromValue(**it); | 425 api::identity::AccountInfo::FromValue(*it); |
426 if (info.get()) | 426 if (info.get()) |
427 result_ids.insert(info->id); | 427 result_ids.insert(info->id); |
428 else | 428 else |
429 return GenerateFailureResult(accounts, results); | 429 return GenerateFailureResult(accounts, results); |
430 } | 430 } |
431 | 431 |
432 for (std::vector<std::string>::const_iterator it = accounts.begin(); | 432 for (std::vector<std::string>::const_iterator it = accounts.begin(); |
433 it != accounts.end(); | 433 it != accounts.end(); |
434 ++it) { | 434 ++it) { |
435 if (result_ids.find(*it) == result_ids.end()) | 435 if (result_ids.find(*it) == result_ids.end()) |
(...skipping 11 matching lines...) Expand all Loading... |
447 it != accounts.end(); | 447 it != accounts.end(); |
448 ++it) { | 448 ++it) { |
449 msg << *it << " "; | 449 msg << *it << " "; |
450 } | 450 } |
451 msg << "Actual: "; | 451 msg << "Actual: "; |
452 if (!results) { | 452 if (!results) { |
453 msg << "NULL"; | 453 msg << "NULL"; |
454 } else { | 454 } else { |
455 for (const auto& result : *results) { | 455 for (const auto& result : *results) { |
456 std::unique_ptr<api::identity::AccountInfo> info = | 456 std::unique_ptr<api::identity::AccountInfo> info = |
457 api::identity::AccountInfo::FromValue(*result); | 457 api::identity::AccountInfo::FromValue(result); |
458 if (info.get()) | 458 if (info.get()) |
459 msg << info->id << " "; | 459 msg << info->id << " "; |
460 else | 460 else |
461 msg << *result << "<-" << result->GetType() << " "; | 461 msg << result << "<-" << result.GetType() << " "; |
462 } | 462 } |
463 } | 463 } |
464 | 464 |
465 return testing::AssertionFailure(msg); | 465 return testing::AssertionFailure(msg); |
466 } | 466 } |
467 }; | 467 }; |
468 | 468 |
469 IN_PROC_BROWSER_TEST_F(IdentityGetAccountsFunctionTest, MultiAccountOn) { | 469 IN_PROC_BROWSER_TEST_F(IdentityGetAccountsFunctionTest, MultiAccountOn) { |
470 EXPECT_TRUE(switches::IsExtensionsMultiAccount()); | 470 EXPECT_TRUE(switches::IsExtensionsMultiAccount()); |
471 } | 471 } |
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1858 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), | 1858 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), |
1859 url); | 1859 url); |
1860 } | 1860 } |
1861 | 1861 |
1862 } // namespace extensions | 1862 } // namespace extensions |
1863 | 1863 |
1864 // Tests the chrome.identity API implemented by custom JS bindings . | 1864 // Tests the chrome.identity API implemented by custom JS bindings . |
1865 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeIdentityJsBindings) { | 1865 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeIdentityJsBindings) { |
1866 ASSERT_TRUE(RunExtensionTest("identity/js_bindings")) << message_; | 1866 ASSERT_TRUE(RunExtensionTest("identity/js_bindings")) << message_; |
1867 } | 1867 } |
OLD | NEW |