| 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 "chrome/browser/chromeos/contacts/contact_map.h" | 5 #include "chrome/browser/chromeos/contacts/contact_map.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "chrome/browser/chromeos/contacts/contact.pb.h" | 10 #include "chrome/browser/chromeos/contacts/contact.pb.h" |
| 11 #include "chrome/browser/chromeos/contacts/contact_test_util.h" | 11 #include "chrome/browser/chromeos/contacts/contact_test_util.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace contacts { | 14 namespace contacts { |
| 15 namespace test { | 15 namespace test { |
| 16 | 16 |
| 17 typedef testing::Test ContactMapTest; | 17 TEST(ContactMapTest, Merge) { |
| 18 | |
| 19 TEST_F(ContactMapTest, Merge) { | |
| 20 ContactMap map; | 18 ContactMap map; |
| 21 EXPECT_TRUE(map.empty()); | 19 EXPECT_TRUE(map.empty()); |
| 22 EXPECT_EQ(0U, map.size()); | 20 EXPECT_EQ(0U, map.size()); |
| 23 EXPECT_EQ(base::Time(), map.GetMaxUpdateTime()); | 21 EXPECT_EQ(base::Time(), map.GetMaxUpdateTime()); |
| 24 | 22 |
| 25 // Create a contact. | 23 // Create a contact. |
| 26 const std::string kContactId1 = "contact_id_1"; | 24 const std::string kContactId1 = "contact_id_1"; |
| 27 scoped_ptr<Contact> contact1(new Contact); | 25 scoped_ptr<Contact> contact1(new Contact); |
| 28 InitContact(kContactId1, "1", false, contact1.get()); | 26 InitContact(kContactId1, "1", false, contact1.get()); |
| 29 const base::Time kUpdateTime1 = base::Time::FromInternalValue(100); | 27 const base::Time kUpdateTime1 = base::Time::FromInternalValue(100); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 EXPECT_EQ(kUpdateTime2, map.GetMaxUpdateTime()); | 96 EXPECT_EQ(kUpdateTime2, map.GetMaxUpdateTime()); |
| 99 | 97 |
| 100 map.Clear(); | 98 map.Clear(); |
| 101 EXPECT_TRUE(map.empty()); | 99 EXPECT_TRUE(map.empty()); |
| 102 EXPECT_EQ(0U, map.size()); | 100 EXPECT_EQ(0U, map.size()); |
| 103 EXPECT_EQ(base::Time(), map.GetMaxUpdateTime()); | 101 EXPECT_EQ(base::Time(), map.GetMaxUpdateTime()); |
| 104 } | 102 } |
| 105 | 103 |
| 106 } // namespace test | 104 } // namespace test |
| 107 } // namespace contacts | 105 } // namespace contacts |
| OLD | NEW |