| 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/history/android/android_history_provider_service.h" | 5 #include "chrome/browser/history/android/android_history_provider_service.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "base/task/cancelable_task_tracker.h" | 8 #include "base/task/cancelable_task_tracker.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 AndroidHistoryProviderServiceTest() | 37 AndroidHistoryProviderServiceTest() |
| 38 : profile_manager_( | 38 : profile_manager_( |
| 39 TestingBrowserProcess::GetGlobal()), | 39 TestingBrowserProcess::GetGlobal()), |
| 40 ui_thread_(BrowserThread::UI, &message_loop_), | 40 ui_thread_(BrowserThread::UI, &message_loop_), |
| 41 file_thread_(BrowserThread::FILE, &message_loop_) { | 41 file_thread_(BrowserThread::FILE, &message_loop_) { |
| 42 } | 42 } |
| 43 virtual ~AndroidHistoryProviderServiceTest() { | 43 virtual ~AndroidHistoryProviderServiceTest() { |
| 44 } | 44 } |
| 45 | 45 |
| 46 protected: | 46 protected: |
| 47 virtual void SetUp() OVERRIDE { | 47 virtual void SetUp() override { |
| 48 // Setup the testing profile, so the bookmark_model_sql_handler could | 48 // Setup the testing profile, so the bookmark_model_sql_handler could |
| 49 // get the bookmark model from it. | 49 // get the bookmark model from it. |
| 50 ASSERT_TRUE(profile_manager_.SetUp()); | 50 ASSERT_TRUE(profile_manager_.SetUp()); |
| 51 // It seems that the name has to be chrome::kInitialProfile, so it | 51 // It seems that the name has to be chrome::kInitialProfile, so it |
| 52 // could be found by ProfileManager::GetLastUsedProfile(). | 52 // could be found by ProfileManager::GetLastUsedProfile(). |
| 53 testing_profile_ = profile_manager_.CreateTestingProfile( | 53 testing_profile_ = profile_manager_.CreateTestingProfile( |
| 54 chrome::kInitialProfile); | 54 chrome::kInitialProfile); |
| 55 | 55 |
| 56 testing_profile_->CreateBookmarkModel(true); | 56 testing_profile_->CreateBookmarkModel(true); |
| 57 test::WaitForBookmarkModelToLoad( | 57 test::WaitForBookmarkModelToLoad( |
| 58 BookmarkModelFactory::GetForProfile(testing_profile_)); | 58 BookmarkModelFactory::GetForProfile(testing_profile_)); |
| 59 ASSERT_TRUE(testing_profile_->CreateHistoryService(true, false)); | 59 ASSERT_TRUE(testing_profile_->CreateHistoryService(true, false)); |
| 60 service_.reset(new AndroidHistoryProviderService(testing_profile_)); | 60 service_.reset(new AndroidHistoryProviderService(testing_profile_)); |
| 61 } | 61 } |
| 62 | 62 |
| 63 virtual void TearDown() OVERRIDE { | 63 virtual void TearDown() override { |
| 64 testing_profile_->DestroyHistoryService(); | 64 testing_profile_->DestroyHistoryService(); |
| 65 profile_manager_.DeleteTestingProfile(chrome::kInitialProfile); | 65 profile_manager_.DeleteTestingProfile(chrome::kInitialProfile); |
| 66 testing_profile_=NULL; | 66 testing_profile_=NULL; |
| 67 } | 67 } |
| 68 | 68 |
| 69 protected: | 69 protected: |
| 70 TestingProfileManager profile_manager_; | 70 TestingProfileManager profile_manager_; |
| 71 base::MessageLoop message_loop_; | 71 base::MessageLoop message_loop_; |
| 72 content::TestBrowserThread ui_thread_; | 72 content::TestBrowserThread ui_thread_; |
| 73 content::TestBrowserThread file_thread_; | 73 content::TestBrowserThread file_thread_; |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 service_->DeleteSearchTerms(std::string(), | 276 service_->DeleteSearchTerms(std::string(), |
| 277 std::vector<base::string16>(), | 277 std::vector<base::string16>(), |
| 278 Bind(&CallbackHelper::OnDeleted, callback.get()), | 278 Bind(&CallbackHelper::OnDeleted, callback.get()), |
| 279 &cancelable_tracker_); | 279 &cancelable_tracker_); |
| 280 base::MessageLoop::current()->Run(); | 280 base::MessageLoop::current()->Run(); |
| 281 EXPECT_TRUE(callback->success()); | 281 EXPECT_TRUE(callback->success()); |
| 282 EXPECT_EQ(1, callback->count()); | 282 EXPECT_EQ(1, callback->count()); |
| 283 } | 283 } |
| 284 | 284 |
| 285 } // namespace | 285 } // namespace |
| OLD | NEW |