| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/signin/core/browser/account_info.h" | 5 #include "components/signin/core/browser/account_info.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 | 7 |
| 8 class AccountInfoTest : public testing::Test {}; | 8 class AccountInfoTest : public testing::Test {}; |
| 9 | 9 |
| 10 // Tests that IsValid() returns true only when all the fields are non-empty. | 10 // Tests that IsValid() returns true only when all the fields are non-empty. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 other.gaia = other.email = "test_other_id"; | 50 other.gaia = other.email = "test_other_id"; |
| 51 other.is_child_account = false; | 51 other.is_child_account = false; |
| 52 | 52 |
| 53 EXPECT_FALSE(info.UpdateWith(other)); | 53 EXPECT_FALSE(info.UpdateWith(other)); |
| 54 EXPECT_EQ("test_id", info.gaia); | 54 EXPECT_EQ("test_id", info.gaia); |
| 55 EXPECT_EQ("test_id", info.email); | 55 EXPECT_EQ("test_id", info.email); |
| 56 EXPECT_TRUE(info.is_child_account); | 56 EXPECT_TRUE(info.is_child_account); |
| 57 } | 57 } |
| 58 | 58 |
| 59 // Tests that UpdateWith() correctly updates its fields that were not set. | 59 // Tests that UpdateWith() correctly updates its fields that were not set. |
| 60 // Fails under MSan. crbug.com/577333 | 60 TEST_F(AccountInfoTest, UpdateWithSuccessfulUpdate) { |
| 61 #if defined(MEMORY_SANITIZER) | |
| 62 #define MAYBE_UpdateWithSuccessfulUpdate DISABLED_UpdateWithSuccessfulUpdate | |
| 63 #else | |
| 64 #define MAYBE_UpdateWithSuccessfulUpdate UpdateWithSuccessfulUpdate | |
| 65 #endif | |
| 66 TEST_F(AccountInfoTest, MAYBE_UpdateWithSuccessfulUpdate) { | |
| 67 AccountInfo info; | 61 AccountInfo info; |
| 68 info.account_id = info.gaia = info.email = "test_id"; | 62 info.account_id = info.gaia = info.email = "test_id"; |
| 69 | 63 |
| 70 AccountInfo other; | 64 AccountInfo other; |
| 71 other.account_id = "test_id"; | 65 other.account_id = "test_id"; |
| 72 other.full_name = other.given_name = "test_name"; | 66 other.full_name = other.given_name = "test_name"; |
| 73 other.is_child_account = true; | 67 other.is_child_account = true; |
| 74 | 68 |
| 75 EXPECT_TRUE(info.UpdateWith(other)); | 69 EXPECT_TRUE(info.UpdateWith(other)); |
| 76 EXPECT_EQ("test_id", info.gaia); | 70 EXPECT_EQ("test_id", info.gaia); |
| 77 EXPECT_EQ("test_id", info.email); | 71 EXPECT_EQ("test_id", info.email); |
| 78 EXPECT_EQ("test_name", info.full_name); | 72 EXPECT_EQ("test_name", info.full_name); |
| 79 EXPECT_EQ("test_name", info.given_name); | 73 EXPECT_EQ("test_name", info.given_name); |
| 80 EXPECT_TRUE(info.is_child_account); | 74 EXPECT_TRUE(info.is_child_account); |
| 81 } | 75 } |
| OLD | NEW |