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/bookmark_model_sql_handler.h" | 5 #include "chrome/browser/history/android/bookmark_model_sql_handler.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 void SetUp() override { | 41 void SetUp() override { |
42 // Setup the testing profile, so the bookmark_model_sql_handler could | 42 // Setup the testing profile, so the bookmark_model_sql_handler could |
43 // get the bookmark model from it. | 43 // get the bookmark model from it. |
44 ASSERT_TRUE(profile_manager_.SetUp()); | 44 ASSERT_TRUE(profile_manager_.SetUp()); |
45 // It seems that the name has to be chrome::kInitialProfile, so it | 45 // It seems that the name has to be chrome::kInitialProfile, so it |
46 // could be found by ProfileManager::GetLastUsedProfile(). | 46 // could be found by ProfileManager::GetLastUsedProfile(). |
47 TestingProfile* testing_profile = profile_manager_.CreateTestingProfile( | 47 TestingProfile* testing_profile = profile_manager_.CreateTestingProfile( |
48 chrome::kInitialProfile); | 48 chrome::kInitialProfile); |
49 // Create the BookmarkModel that doesn't need to invoke load(). | 49 // Create the BookmarkModel that doesn't need to invoke load(). |
50 testing_profile->CreateBookmarkModel(true); | 50 testing_profile->CreateBookmarkModel(true); |
51 bookmark_model_ = BookmarkModelFactory::GetForProfile(testing_profile); | 51 bookmark_model_ = |
| 52 BookmarkModelFactory::GetForBrowserContext(testing_profile); |
52 bookmarks::test::WaitForBookmarkModelToLoad(bookmark_model_); | 53 bookmarks::test::WaitForBookmarkModelToLoad(bookmark_model_); |
53 ASSERT_TRUE(bookmark_model_); | 54 ASSERT_TRUE(bookmark_model_); |
54 // Get the BookmarkModel from LastUsedProfile, this is the same way that | 55 // Get the BookmarkModel from LastUsedProfile, this is the same way that |
55 // how the BookmarkModelSQLHandler gets the BookmarkModel. | 56 // how the BookmarkModelSQLHandler gets the BookmarkModel. |
56 Profile* profile = ProfileManager::GetLastUsedProfile(); | 57 Profile* profile = ProfileManager::GetLastUsedProfile(); |
57 ASSERT_TRUE(profile); | 58 ASSERT_TRUE(profile); |
58 | 59 |
59 // Create the directory for history database. | 60 // Create the directory for history database. |
60 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 61 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
61 base::FilePath history_db_name = | 62 base::FilePath history_db_name = |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 id_row.url = url1; | 247 id_row.url = url1; |
247 id_rows.clear(); | 248 id_rows.clear(); |
248 id_rows.push_back(id_row); | 249 id_rows.push_back(id_row); |
249 ASSERT_TRUE(handler.Delete(id_rows)); | 250 ASSERT_TRUE(handler.Delete(id_rows)); |
250 RunMessageLoopForUI(); | 251 RunMessageLoopForUI(); |
251 // All bookmarks were deleted. | 252 // All bookmarks were deleted. |
252 EXPECT_FALSE(bookmark_model_->HasBookmarks()); | 253 EXPECT_FALSE(bookmark_model_->HasBookmarks()); |
253 } | 254 } |
254 | 255 |
255 } // namespace history | 256 } // namespace history |
OLD | NEW |