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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_ = BookmarkModelFactory::GetForProfile(testing_profile); |
52 bookmarks::test::WaitForBookmarkModelToLoad(bookmark_model_); | 52 bookmarks::test::WaitForBookmarkModelToLoad(bookmark_model_); |
53 ASSERT_TRUE(bookmark_model_); | 53 ASSERT_TRUE(bookmark_model_); |
54 // Get the BookmarkModel from LastUsedProfile, this is the same way that | 54 // Get the BookmarkModel from LastUsedProfile, this is the same way that |
55 // how the BookmarkModelSQLHandler gets the BookmarkModel. | 55 // how the BookmarkModelSQLHandler gets the BookmarkModel. |
56 Profile* profile = ProfileManager::GetLastUsedProfile(); | 56 Profile* profile = profile_manager_.GetLastUsedProfile(); |
57 ASSERT_TRUE(profile); | 57 ASSERT_TRUE(profile); |
58 | 58 |
59 // Create the directory for history database. | 59 // Create the directory for history database. |
60 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 60 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
61 base::FilePath history_db_name = | 61 base::FilePath history_db_name = |
62 temp_dir_.path().AppendASCII(kHistoryFilename); | 62 temp_dir_.path().AppendASCII(kHistoryFilename); |
63 history_db_.Init(history_db_name); | 63 history_db_.Init(history_db_name); |
64 } | 64 } |
65 | 65 |
66 // Runs the MessageLoopForUI, and return till all pending messages were | 66 // Runs the MessageLoopForUI, and return till all pending messages were |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 id_row.url = url1; | 246 id_row.url = url1; |
247 id_rows.clear(); | 247 id_rows.clear(); |
248 id_rows.push_back(id_row); | 248 id_rows.push_back(id_row); |
249 ASSERT_TRUE(handler.Delete(id_rows)); | 249 ASSERT_TRUE(handler.Delete(id_rows)); |
250 RunMessageLoopForUI(); | 250 RunMessageLoopForUI(); |
251 // All bookmarks were deleted. | 251 // All bookmarks were deleted. |
252 EXPECT_FALSE(bookmark_model_->HasBookmarks()); | 252 EXPECT_FALSE(bookmark_model_->HasBookmarks()); |
253 } | 253 } |
254 | 254 |
255 } // namespace history | 255 } // namespace history |
OLD | NEW |