| 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 16 matching lines...) Expand all Loading... |
| 27 class TestProfileWriter : public ProfileWriter { | 27 class TestProfileWriter : public ProfileWriter { |
| 28 public: | 28 public: |
| 29 explicit TestProfileWriter(Profile* profile) : ProfileWriter(profile) {} | 29 explicit TestProfileWriter(Profile* profile) : ProfileWriter(profile) {} |
| 30 protected: | 30 protected: |
| 31 virtual ~TestProfileWriter() {} | 31 virtual ~TestProfileWriter() {} |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 class ProfileWriterTest : public testing::Test { | 34 class ProfileWriterTest : public testing::Test { |
| 35 public: | 35 public: |
| 36 ProfileWriterTest() | 36 ProfileWriterTest() |
| 37 : loop_(base::MessageLoop::TYPE_DEFAULT), | 37 : ui_thread_(BrowserThread::UI, &loop_), |
| 38 ui_thread_(BrowserThread::UI, &loop_), | |
| 39 file_thread_(BrowserThread::FILE, &loop_) { | 38 file_thread_(BrowserThread::FILE, &loop_) { |
| 40 } | 39 } |
| 41 virtual ~ProfileWriterTest() {} | 40 virtual ~ProfileWriterTest() {} |
| 42 | 41 |
| 43 // Create test bookmark entries to be added to ProfileWriter to | 42 // Create test bookmark entries to be added to ProfileWriter to |
| 44 // simulate bookmark importing. | 43 // simulate bookmark importing. |
| 45 void CreateImportedBookmarksEntries() { | 44 void CreateImportedBookmarksEntries() { |
| 46 AddImportedBookmarkEntry(GURL("http://www.google.com"), | 45 AddImportedBookmarkEntry(GURL("http://www.google.com"), |
| 47 base::ASCIIToUTF16("Google")); | 46 base::ASCIIToUTF16("Google")); |
| 48 AddImportedBookmarkEntry(GURL("http://www.yahoo.com"), | 47 AddImportedBookmarkEntry(GURL("http://www.yahoo.com"), |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 new TestProfileWriter(&profile)); | 205 new TestProfileWriter(&profile)); |
| 207 profile_writer->AddHistoryPage(pages_, history::SOURCE_FIREFOX_IMPORTED); | 206 profile_writer->AddHistoryPage(pages_, history::SOURCE_FIREFOX_IMPORTED); |
| 208 VerifyHistoryCount(&profile); | 207 VerifyHistoryCount(&profile); |
| 209 size_t original_history_count = history_count_; | 208 size_t original_history_count = history_count_; |
| 210 history_count_ = 0; | 209 history_count_ = 0; |
| 211 | 210 |
| 212 profile_writer->AddHistoryPage(pages_, history::SOURCE_FIREFOX_IMPORTED); | 211 profile_writer->AddHistoryPage(pages_, history::SOURCE_FIREFOX_IMPORTED); |
| 213 VerifyHistoryCount(&profile); | 212 VerifyHistoryCount(&profile); |
| 214 EXPECT_EQ(original_history_count, history_count_); | 213 EXPECT_EQ(original_history_count, history_count_); |
| 215 } | 214 } |
| OLD | NEW |