1868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 2868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// found in the LICENSE file. 4868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#include "chrome/browser/importer/profile_writer.h" 658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 7868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include <string> 8868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 9ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch#include "base/message_loop/message_loop.h" 10868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/strings/utf_string_conversions.h" 11868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "chrome/browser/bookmarks/bookmark_model_factory.h" 1258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#include "chrome/browser/history/history_service.h" 13868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "chrome/browser/history/history_service_factory.h" 14868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "chrome/browser/importer/importer_unittest_utils.h" 15eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#include "chrome/common/importer/imported_bookmark_entry.h" 16868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "chrome/test/base/testing_profile.h" 17cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "components/bookmarks/browser/bookmark_match.h" 18cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "components/bookmarks/browser/bookmark_model.h" 19cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "components/bookmarks/browser/bookmark_utils.h" 20cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "components/bookmarks/test/bookmark_test_helpers.h" 211320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "components/history/core/browser/history_types.h" 22868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "content/public/test/test_browser_thread.h" 23868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "testing/gtest/include/gtest/gtest.h" 24868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 25f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)using bookmarks::BookmarkMatch; 26868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)using content::BrowserThread; 27868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 28868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)class TestProfileWriter : public ProfileWriter { 29868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) public: 30868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) explicit TestProfileWriter(Profile* profile) : ProfileWriter(profile) {} 31868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) protected: 32868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual ~TestProfileWriter() {} 33868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}; 34868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 35868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)class ProfileWriterTest : public testing::Test { 36868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) public: 37868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) ProfileWriterTest() 385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) : ui_thread_(BrowserThread::UI, &loop_), 39868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) file_thread_(BrowserThread::FILE, &loop_) { 40868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) } 41868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual ~ProfileWriterTest() {} 42868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 43868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // Create test bookmark entries to be added to ProfileWriter to 44868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // simulate bookmark importing. 45868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) void CreateImportedBookmarksEntries() { 46868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) AddImportedBookmarkEntry(GURL("http://www.google.com"), 475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) base::ASCIIToUTF16("Google")); 48868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) AddImportedBookmarkEntry(GURL("http://www.yahoo.com"), 495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) base::ASCIIToUTF16("Yahoo")); 50868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) } 51868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 52868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // Helper function to create history entries. 53868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) history::URLRow MakeURLRow(const char* url, 54a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) base::string16 title, 55868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) int visit_count, 56868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) int days_since_last_visit, 57868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) int typed_count) { 58868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) history::URLRow row(GURL(url), 0); 59868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) row.set_title(title); 60868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) row.set_visit_count(visit_count); 61868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) row.set_typed_count(typed_count); 62868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) row.set_last_visit(base::Time::NowFromSystemTime() - 63868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) base::TimeDelta::FromDays(days_since_last_visit)); 64868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) return row; 65868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) } 66868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 67868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // Create test history entries to be added to ProfileWriter to 68868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // simulate history importing. 69868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) void CreateHistoryPageEntries() { 70868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) history::URLRow row1( 715d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) MakeURLRow("http://www.google.com", base::ASCIIToUTF16("Google"), 725d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 3, 10, 1)); 73868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) history::URLRow row2( 745d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) MakeURLRow("http://www.yahoo.com", base::ASCIIToUTF16("Yahoo"), 755d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 3, 30, 10)); 76868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) pages_.push_back(row1); 77868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) pages_.push_back(row2); 78868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) } 79868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 80868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) void VerifyBookmarksCount( 8146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) const std::vector<BookmarkModel::URLAndTitle>& bookmarks_record, 82868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) BookmarkModel* bookmark_model, 83868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) size_t expected) { 840529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch std::vector<BookmarkMatch> matches; 85868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) for (size_t i = 0; i < bookmarks_record.size(); ++i) { 860529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch bookmark_model->GetBookmarksMatching( 870529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch bookmarks_record[i].title, 10, &matches); 88868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) EXPECT_EQ(expected, matches.size()); 89868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) matches.clear(); 90868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) } 91868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) } 92868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 93868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) void VerifyHistoryCount(Profile* profile) { 94868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) HistoryService* history_service = 95868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) HistoryServiceFactory::GetForProfile(profile, 96868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) Profile::EXPLICIT_ACCESS); 97868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) history::QueryOptions options; 98116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch base::CancelableTaskTracker history_task_tracker; 99868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) history_service->QueryHistory( 100a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) base::string16(), 101868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) options, 102868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) base::Bind(&ProfileWriterTest::HistoryQueryComplete, 103116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch base::Unretained(this)), 104116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch &history_task_tracker); 105868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) base::MessageLoop::current()->Run(); 106868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) } 107868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 108116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch void HistoryQueryComplete(history::QueryResults* results) { 109868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) base::MessageLoop::current()->Quit(); 110868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) history_count_ = results->size(); 111868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) } 112868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 113868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) protected: 114868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) std::vector<ImportedBookmarkEntry> bookmarks_; 115868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) history::URLRows pages_; 116868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) size_t history_count_; 117868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 118868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) private: 119a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) void AddImportedBookmarkEntry(const GURL& url, const base::string16& title) { 120868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) base::Time date; 121868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) ImportedBookmarkEntry entry; 122868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) entry.creation_time = date; 123868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) entry.url = url; 124868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) entry.title = title; 125868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) entry.in_toolbar = true; 126868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) entry.is_folder = false; 127868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) bookmarks_.push_back(entry); 128868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) } 129868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 130868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) base::MessageLoop loop_; 131868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) content::TestBrowserThread ui_thread_; 132868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) content::TestBrowserThread file_thread_; 133868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 134868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(ProfileWriterTest); 135868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}; 136868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 137868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Add bookmarks via ProfileWriter to profile1 when profile2 also exists. 138868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)TEST_F(ProfileWriterTest, CheckBookmarksWithMultiProfile) { 139868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) TestingProfile profile2; 140868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) profile2.CreateBookmarkModel(true); 141868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 142868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) BookmarkModel* bookmark_model2 = 143868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) BookmarkModelFactory::GetForProfile(&profile2); 14458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) test::WaitForBookmarkModelToLoad(bookmark_model2); 145116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch bookmarks::AddIfNotBookmarked( 146116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch bookmark_model2, GURL("http://www.bing.com"), base::ASCIIToUTF16("Bing")); 147868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) TestingProfile profile1; 148868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) profile1.CreateBookmarkModel(true); 149868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 150868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) CreateImportedBookmarksEntries(); 151868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) BookmarkModel* bookmark_model1 = 152868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) BookmarkModelFactory::GetForProfile(&profile1); 15358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) test::WaitForBookmarkModelToLoad(bookmark_model1); 154868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 155868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) scoped_refptr<TestProfileWriter> profile_writer( 156868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) new TestProfileWriter(&profile1)); 157868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) profile_writer->AddBookmarks(bookmarks_, 1585d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) base::ASCIIToUTF16("Imported from Firefox")); 159868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 16046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) std::vector<BookmarkModel::URLAndTitle> url_record1; 161868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) bookmark_model1->GetBookmarks(&url_record1); 162868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) EXPECT_EQ(2u, url_record1.size()); 163868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 16446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) std::vector<BookmarkModel::URLAndTitle> url_record2; 165868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) bookmark_model2->GetBookmarks(&url_record2); 166868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) EXPECT_EQ(1u, url_record2.size()); 167868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)} 168868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 169868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Verify that bookmarks are duplicated when added twice. 170868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)TEST_F(ProfileWriterTest, CheckBookmarksAfterWritingDataTwice) { 171868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) TestingProfile profile; 172868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) profile.CreateBookmarkModel(true); 173868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 174868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) CreateImportedBookmarksEntries(); 175868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) BookmarkModel* bookmark_model = 176868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) BookmarkModelFactory::GetForProfile(&profile); 17758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) test::WaitForBookmarkModelToLoad(bookmark_model); 178868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 179868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) scoped_refptr<TestProfileWriter> profile_writer( 180868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) new TestProfileWriter(&profile)); 181868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) profile_writer->AddBookmarks(bookmarks_, 1825d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) base::ASCIIToUTF16("Imported from Firefox")); 18346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) std::vector<BookmarkModel::URLAndTitle> bookmarks_record; 184868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) bookmark_model->GetBookmarks(&bookmarks_record); 185868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) EXPECT_EQ(2u, bookmarks_record.size()); 186868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 187868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) VerifyBookmarksCount(bookmarks_record, bookmark_model, 1); 188868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 189868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) profile_writer->AddBookmarks(bookmarks_, 1905d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) base::ASCIIToUTF16("Imported from Firefox")); 191868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // Verify that duplicate bookmarks exist. 192868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) VerifyBookmarksCount(bookmarks_record, bookmark_model, 2); 193868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)} 194868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 195868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Verify that history entires are not duplicated when added twice. 196868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)TEST_F(ProfileWriterTest, CheckHistoryAfterWritingDataTwice) { 197868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) TestingProfile profile; 198bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3Ben Murdoch ASSERT_TRUE(profile.CreateHistoryService(true, false)); 199868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) profile.BlockUntilHistoryProcessesPendingRequests(); 200868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 201868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) CreateHistoryPageEntries(); 202868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) scoped_refptr<TestProfileWriter> profile_writer( 203868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) new TestProfileWriter(&profile)); 204868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) profile_writer->AddHistoryPage(pages_, history::SOURCE_FIREFOX_IMPORTED); 205868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) VerifyHistoryCount(&profile); 206868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) size_t original_history_count = history_count_; 207868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) history_count_ = 0; 208868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 209868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) profile_writer->AddHistoryPage(pages_, history::SOURCE_FIREFOX_IMPORTED); 210868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) VerifyHistoryCount(&profile); 211868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) EXPECT_EQ(original_history_count, history_count_); 212868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)} 213