| 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_database.h" | 5 #include "chrome/browser/chromeos/contacts/contact_database.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/files/scoped_temp_dir.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 14 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
| 15 #include "base/scoped_temp_dir.h" | |
| 16 #include "chrome/browser/chromeos/contacts/contact.pb.h" | 16 #include "chrome/browser/chromeos/contacts/contact.pb.h" |
| 17 #include "chrome/browser/chromeos/contacts/contact_test_util.h" | 17 #include "chrome/browser/chromeos/contacts/contact_test_util.h" |
| 18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 19 #include "content/public/test/test_browser_thread.h" | 19 #include "content/public/test/test_browser_thread.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 21 #include "ui/gfx/size.h" | 21 #include "ui/gfx/size.h" |
| 22 | 22 |
| 23 using content::BrowserThread; | 23 using content::BrowserThread; |
| 24 | 24 |
| 25 namespace contacts { | 25 namespace contacts { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 CHECK(success); | 126 CHECK(success); |
| 127 loaded_contacts_.swap(contacts); | 127 loaded_contacts_.swap(contacts); |
| 128 loaded_metadata_.swap(metadata); | 128 loaded_metadata_.swap(metadata); |
| 129 message_loop_.Quit(); | 129 message_loop_.Quit(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 MessageLoopForUI message_loop_; | 132 MessageLoopForUI message_loop_; |
| 133 content::TestBrowserThread ui_thread_; | 133 content::TestBrowserThread ui_thread_; |
| 134 | 134 |
| 135 // Temporary directory where the database is saved. | 135 // Temporary directory where the database is saved. |
| 136 ScopedTempDir temp_dir_; | 136 base::ScopedTempDir temp_dir_; |
| 137 | 137 |
| 138 // This class retains ownership of this object. | 138 // This class retains ownership of this object. |
| 139 ContactDatabase* db_; | 139 ContactDatabase* db_; |
| 140 | 140 |
| 141 // Contacts and metadata returned by the most-recent | 141 // Contacts and metadata returned by the most-recent |
| 142 // ContactDatabase::LoadContacts() call. Used to pass returned values from | 142 // ContactDatabase::LoadContacts() call. Used to pass returned values from |
| 143 // OnContactsLoaded() to LoadContacts(). | 143 // OnContactsLoaded() to LoadContacts(). |
| 144 scoped_ptr<ScopedVector<Contact> > loaded_contacts_; | 144 scoped_ptr<ScopedVector<Contact> > loaded_contacts_; |
| 145 scoped_ptr<UpdateMetadata> loaded_metadata_; | 145 scoped_ptr<UpdateMetadata> loaded_metadata_; |
| 146 | 146 |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 contact_ids_to_delete.Pass(), | 407 contact_ids_to_delete.Pass(), |
| 408 metadata_to_save.Pass(), | 408 metadata_to_save.Pass(), |
| 409 false); | 409 false); |
| 410 LoadContacts(&loaded_contacts, &loaded_metadata); | 410 LoadContacts(&loaded_contacts, &loaded_metadata); |
| 411 EXPECT_EQ(VarContactsToString(1, contact3.get()), | 411 EXPECT_EQ(VarContactsToString(1, contact3.get()), |
| 412 ContactsToString(*loaded_contacts)); | 412 ContactsToString(*loaded_contacts)); |
| 413 } | 413 } |
| 414 | 414 |
| 415 } // namespace test | 415 } // namespace test |
| 416 } // namespace contacts | 416 } // namespace contacts |
| OLD | NEW |