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/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
9 #include "chrome/browser/bookmarks/bookmark_test_helpers.h" | 10 #include "chrome/browser/bookmarks/bookmark_test_helpers.h" |
10 #include "chrome/browser/history/android/android_history_types.h" | 11 #include "chrome/browser/history/android/android_history_types.h" |
11 #include "chrome/common/chrome_constants.h" | 12 #include "chrome/common/chrome_constants.h" |
12 #include "chrome/test/base/testing_browser_process.h" | 13 #include "chrome/test/base/testing_browser_process.h" |
13 #include "chrome/test/base/testing_profile.h" | 14 #include "chrome/test/base/testing_profile.h" |
14 #include "chrome/test/base/testing_profile_manager.h" | 15 #include "chrome/test/base/testing_profile_manager.h" |
15 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
16 #include "content/public/test/test_browser_thread.h" | 17 #include "content/public/test/test_browser_thread.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 | 19 |
(...skipping 26 matching lines...) Expand all Loading... |
45 virtual void SetUp() OVERRIDE { | 46 virtual void SetUp() OVERRIDE { |
46 // Setup the testing profile, so the bookmark_model_sql_handler could | 47 // Setup the testing profile, so the bookmark_model_sql_handler could |
47 // get the bookmark model from it. | 48 // get the bookmark model from it. |
48 ASSERT_TRUE(profile_manager_.SetUp()); | 49 ASSERT_TRUE(profile_manager_.SetUp()); |
49 // 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 |
50 // could be found by ProfileManager::GetLastUsedProfile(). | 51 // could be found by ProfileManager::GetLastUsedProfile(). |
51 testing_profile_ = profile_manager_.CreateTestingProfile( | 52 testing_profile_ = profile_manager_.CreateTestingProfile( |
52 chrome::kInitialProfile); | 53 chrome::kInitialProfile); |
53 | 54 |
54 testing_profile_->CreateBookmarkModel(true); | 55 testing_profile_->CreateBookmarkModel(true); |
55 test::WaitForBookmarkModelToLoad(testing_profile_); | 56 test::WaitForBookmarkModelToLoad( |
| 57 BookmarkModelFactory::GetForProfile(testing_profile_)); |
56 ASSERT_TRUE(testing_profile_->CreateHistoryService(true, false)); | 58 ASSERT_TRUE(testing_profile_->CreateHistoryService(true, false)); |
57 service_.reset(new AndroidHistoryProviderService(testing_profile_)); | 59 service_.reset(new AndroidHistoryProviderService(testing_profile_)); |
58 } | 60 } |
59 | 61 |
60 virtual void TearDown() OVERRIDE { | 62 virtual void TearDown() OVERRIDE { |
61 testing_profile_->DestroyHistoryService(); | 63 testing_profile_->DestroyHistoryService(); |
62 profile_manager_.DeleteTestingProfile(chrome::kInitialProfile); | 64 profile_manager_.DeleteTestingProfile(chrome::kInitialProfile); |
63 testing_profile_=NULL; | 65 testing_profile_=NULL; |
64 } | 66 } |
65 | 67 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 | 256 |
255 // Delete the row. | 257 // Delete the row. |
256 service_->DeleteSearchTerms(std::string(), std::vector<base::string16>(), | 258 service_->DeleteSearchTerms(std::string(), std::vector<base::string16>(), |
257 &cancelable_consumer_, Bind(&CallbackHelper::OnDeleted, callback.get())); | 259 &cancelable_consumer_, Bind(&CallbackHelper::OnDeleted, callback.get())); |
258 base::MessageLoop::current()->Run(); | 260 base::MessageLoop::current()->Run(); |
259 EXPECT_TRUE(callback->success()); | 261 EXPECT_TRUE(callback->success()); |
260 EXPECT_EQ(1, callback->count()); | 262 EXPECT_EQ(1, callback->count()); |
261 } | 263 } |
262 | 264 |
263 } // namespace | 265 } // namespace |
OLD | NEW |