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/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 history_service->QueryHistory( | 95 history_service->QueryHistory( |
96 base::string16(), | 96 base::string16(), |
97 options, | 97 options, |
98 base::Bind(&ProfileWriterTest::HistoryQueryComplete, | 98 base::Bind(&ProfileWriterTest::HistoryQueryComplete, |
99 base::Unretained(this)), | 99 base::Unretained(this)), |
100 &history_task_tracker); | 100 &history_task_tracker); |
101 base::MessageLoop::current()->Run(); | 101 base::MessageLoop::current()->Run(); |
102 } | 102 } |
103 | 103 |
104 void HistoryQueryComplete(history::QueryResults* results) { | 104 void HistoryQueryComplete(history::QueryResults* results) { |
105 base::MessageLoop::current()->Quit(); | 105 base::MessageLoop::current()->QuitWhenIdle(); |
106 history_count_ = results->size(); | 106 history_count_ = results->size(); |
107 } | 107 } |
108 | 108 |
109 protected: | 109 protected: |
110 std::vector<ImportedBookmarkEntry> bookmarks_; | 110 std::vector<ImportedBookmarkEntry> bookmarks_; |
111 history::URLRows pages_; | 111 history::URLRows pages_; |
112 size_t history_count_; | 112 size_t history_count_; |
113 | 113 |
114 private: | 114 private: |
115 void AddImportedBookmarkEntry(const GURL& url, const base::string16& title) { | 115 void AddImportedBookmarkEntry(const GURL& url, const base::string16& title) { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 new TestProfileWriter(&profile)); | 197 new TestProfileWriter(&profile)); |
198 profile_writer->AddHistoryPage(pages_, history::SOURCE_FIREFOX_IMPORTED); | 198 profile_writer->AddHistoryPage(pages_, history::SOURCE_FIREFOX_IMPORTED); |
199 VerifyHistoryCount(&profile); | 199 VerifyHistoryCount(&profile); |
200 size_t original_history_count = history_count_; | 200 size_t original_history_count = history_count_; |
201 history_count_ = 0; | 201 history_count_ = 0; |
202 | 202 |
203 profile_writer->AddHistoryPage(pages_, history::SOURCE_FIREFOX_IMPORTED); | 203 profile_writer->AddHistoryPage(pages_, history::SOURCE_FIREFOX_IMPORTED); |
204 VerifyHistoryCount(&profile); | 204 VerifyHistoryCount(&profile); |
205 EXPECT_EQ(original_history_count, history_count_); | 205 EXPECT_EQ(original_history_count, history_count_); |
206 } | 206 } |
OLD | NEW |