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/importer/importer_unittest_utils.h" | 5 #include "chrome/browser/importer/importer_unittest_utils.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/test/base/testing_profile.h" | 8 #include "chrome/test/base/testing_profile.h" |
9 | 9 |
10 bool EqualBookmarkEntry(const ProfileWriter::BookmarkEntry& entry, | 10 bool EqualBookmarkEntry(const ProfileWriter::BookmarkEntry& entry, |
11 const BookmarkInfo& expected) { | 11 const BookmarkInfo& expected) { |
12 if (expected.in_toolbar != entry.in_toolbar || | 12 if (expected.in_toolbar != entry.in_toolbar || |
13 expected.path_size != entry.path.size() || | 13 expected.path_size != entry.path.size() || |
14 expected.url != entry.url.spec() || | 14 expected.url != entry.url.spec() || |
15 WideToUTF16Hack(expected.title) != entry.title) | 15 base::WideToUTF16Hack(expected.title) != entry.title) |
16 return false; | 16 return false; |
17 for (size_t i = 0; i < expected.path_size; ++i) { | 17 for (size_t i = 0; i < expected.path_size; ++i) { |
18 if (WideToUTF16Hack(expected.path[i]) != entry.path[i]) | 18 if (base::WideToUTF16Hack(expected.path[i]) != entry.path[i]) |
19 return false; | 19 return false; |
20 } | 20 } |
21 return true; | 21 return true; |
22 } | 22 } |
23 | 23 |
24 bool FindBookmarkEntry(const ProfileWriter::BookmarkEntry& entry, | 24 bool FindBookmarkEntry(const ProfileWriter::BookmarkEntry& entry, |
25 const BookmarkInfo* list, int list_size) { | 25 const BookmarkInfo* list, int list_size) { |
26 for (int i = 0; i < list_size; ++i) { | 26 for (int i = 0; i < list_size; ++i) { |
27 if (EqualBookmarkEntry(entry, list[i])) | 27 if (EqualBookmarkEntry(entry, list[i])) |
28 return true; | 28 return true; |
29 } | 29 } |
30 return false; | 30 return false; |
31 } | 31 } |
32 | 32 |
33 ImporterTest::ImporterTest() | 33 ImporterTest::ImporterTest() |
34 : profile_(new TestingProfile()), | 34 : profile_(new TestingProfile()), |
35 ui_thread_(content::BrowserThread::UI, &message_loop_), | 35 ui_thread_(content::BrowserThread::UI, &message_loop_), |
36 file_thread_(content::BrowserThread::FILE, &message_loop_) { | 36 file_thread_(content::BrowserThread::FILE, &message_loop_) { |
37 } | 37 } |
38 | 38 |
39 ImporterTest::~ImporterTest() { | 39 ImporterTest::~ImporterTest() { |
40 profile_.reset(NULL); | 40 profile_.reset(NULL); |
41 } | 41 } |
42 | 42 |
43 void ImporterTest::SetUp() { | 43 void ImporterTest::SetUp() { |
44 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 44 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
45 } | 45 } |
OLD | NEW |