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