| 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 22 matching lines...) Expand all Loading... |
| 33 // AndroidProviderBackend working fine. | 33 // AndroidProviderBackend working fine. |
| 34 | 34 |
| 35 class AndroidHistoryProviderServiceTest : public testing::Test { | 35 class AndroidHistoryProviderServiceTest : public testing::Test { |
| 36 public: | 36 public: |
| 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 ~AndroidHistoryProviderServiceTest() override {} |
| 44 } | |
| 45 | 44 |
| 46 protected: | 45 protected: |
| 47 virtual void SetUp() override { | 46 void SetUp() override { |
| 48 // Setup the testing profile, so the bookmark_model_sql_handler could | 47 // Setup the testing profile, so the bookmark_model_sql_handler could |
| 49 // get the bookmark model from it. | 48 // get the bookmark model from it. |
| 50 ASSERT_TRUE(profile_manager_.SetUp()); | 49 ASSERT_TRUE(profile_manager_.SetUp()); |
| 51 // It seems that the name has to be chrome::kInitialProfile, so it | 50 // It seems that the name has to be chrome::kInitialProfile, so it |
| 52 // could be found by ProfileManager::GetLastUsedProfile(). | 51 // could be found by ProfileManager::GetLastUsedProfile(). |
| 53 testing_profile_ = profile_manager_.CreateTestingProfile( | 52 testing_profile_ = profile_manager_.CreateTestingProfile( |
| 54 chrome::kInitialProfile); | 53 chrome::kInitialProfile); |
| 55 | 54 |
| 56 testing_profile_->CreateBookmarkModel(true); | 55 testing_profile_->CreateBookmarkModel(true); |
| 57 bookmarks::test::WaitForBookmarkModelToLoad( | 56 bookmarks::test::WaitForBookmarkModelToLoad( |
| 58 BookmarkModelFactory::GetForProfile(testing_profile_)); | 57 BookmarkModelFactory::GetForProfile(testing_profile_)); |
| 59 ASSERT_TRUE(testing_profile_->CreateHistoryService(true, false)); | 58 ASSERT_TRUE(testing_profile_->CreateHistoryService(true, false)); |
| 60 service_.reset(new AndroidHistoryProviderService(testing_profile_)); | 59 service_.reset(new AndroidHistoryProviderService(testing_profile_)); |
| 61 } | 60 } |
| 62 | 61 |
| 63 virtual void TearDown() override { | 62 void TearDown() override { |
| 64 testing_profile_->DestroyHistoryService(); | 63 testing_profile_->DestroyHistoryService(); |
| 65 profile_manager_.DeleteTestingProfile(chrome::kInitialProfile); | 64 profile_manager_.DeleteTestingProfile(chrome::kInitialProfile); |
| 66 testing_profile_=NULL; | 65 testing_profile_=NULL; |
| 67 } | 66 } |
| 68 | 67 |
| 69 protected: | 68 protected: |
| 70 TestingProfileManager profile_manager_; | 69 TestingProfileManager profile_manager_; |
| 71 base::MessageLoop message_loop_; | 70 base::MessageLoop message_loop_; |
| 72 content::TestBrowserThread ui_thread_; | 71 content::TestBrowserThread ui_thread_; |
| 73 content::TestBrowserThread file_thread_; | 72 content::TestBrowserThread file_thread_; |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 service_->DeleteSearchTerms(std::string(), | 275 service_->DeleteSearchTerms(std::string(), |
| 277 std::vector<base::string16>(), | 276 std::vector<base::string16>(), |
| 278 Bind(&CallbackHelper::OnDeleted, callback.get()), | 277 Bind(&CallbackHelper::OnDeleted, callback.get()), |
| 279 &cancelable_tracker_); | 278 &cancelable_tracker_); |
| 280 base::MessageLoop::current()->Run(); | 279 base::MessageLoop::current()->Run(); |
| 281 EXPECT_TRUE(callback->success()); | 280 EXPECT_TRUE(callback->success()); |
| 282 EXPECT_EQ(1, callback->count()); | 281 EXPECT_EQ(1, callback->count()); |
| 283 } | 282 } |
| 284 | 283 |
| 285 } // namespace | 284 } // namespace |
| OLD | NEW |