| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/profile_writer.h" | 5 #include "chrome/browser/importer/profile_writer.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 std::vector<BookmarkMatch> matches; | 84 std::vector<BookmarkMatch> matches; |
| 85 for (size_t i = 0; i < bookmarks_record.size(); ++i) { | 85 for (size_t i = 0; i < bookmarks_record.size(); ++i) { |
| 86 bookmark_model->GetBookmarksMatching( | 86 bookmark_model->GetBookmarksMatching( |
| 87 bookmarks_record[i].title, 10, &matches); | 87 bookmarks_record[i].title, 10, &matches); |
| 88 EXPECT_EQ(expected, matches.size()); | 88 EXPECT_EQ(expected, matches.size()); |
| 89 matches.clear(); | 89 matches.clear(); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 void VerifyHistoryCount(Profile* profile) { | 93 void VerifyHistoryCount(Profile* profile) { |
| 94 HistoryService* history_service = | 94 HistoryService* history_service = HistoryServiceFactory::GetForProfile( |
| 95 HistoryServiceFactory::GetForProfile(profile, | 95 profile, ServiceAccessType::EXPLICIT_ACCESS); |
| 96 Profile::EXPLICIT_ACCESS); | |
| 97 history::QueryOptions options; | 96 history::QueryOptions options; |
| 98 base::CancelableTaskTracker history_task_tracker; | 97 base::CancelableTaskTracker history_task_tracker; |
| 99 history_service->QueryHistory( | 98 history_service->QueryHistory( |
| 100 base::string16(), | 99 base::string16(), |
| 101 options, | 100 options, |
| 102 base::Bind(&ProfileWriterTest::HistoryQueryComplete, | 101 base::Bind(&ProfileWriterTest::HistoryQueryComplete, |
| 103 base::Unretained(this)), | 102 base::Unretained(this)), |
| 104 &history_task_tracker); | 103 &history_task_tracker); |
| 105 base::MessageLoop::current()->Run(); | 104 base::MessageLoop::current()->Run(); |
| 106 } | 105 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 new TestProfileWriter(&profile)); | 202 new TestProfileWriter(&profile)); |
| 204 profile_writer->AddHistoryPage(pages_, history::SOURCE_FIREFOX_IMPORTED); | 203 profile_writer->AddHistoryPage(pages_, history::SOURCE_FIREFOX_IMPORTED); |
| 205 VerifyHistoryCount(&profile); | 204 VerifyHistoryCount(&profile); |
| 206 size_t original_history_count = history_count_; | 205 size_t original_history_count = history_count_; |
| 207 history_count_ = 0; | 206 history_count_ = 0; |
| 208 | 207 |
| 209 profile_writer->AddHistoryPage(pages_, history::SOURCE_FIREFOX_IMPORTED); | 208 profile_writer->AddHistoryPage(pages_, history::SOURCE_FIREFOX_IMPORTED); |
| 210 VerifyHistoryCount(&profile); | 209 VerifyHistoryCount(&profile); |
| 211 EXPECT_EQ(original_history_count, history_count_); | 210 EXPECT_EQ(original_history_count, history_count_); |
| 212 } | 211 } |
| OLD | NEW |