| 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/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // how the BookmarkModelSQLHandler gets the BookmarkModel. | 51 // how the BookmarkModelSQLHandler gets the BookmarkModel. |
| 52 Profile* profile = ProfileManager::GetLastUsedProfile(); | 52 Profile* profile = ProfileManager::GetLastUsedProfile(); |
| 53 ASSERT_TRUE(profile); | 53 ASSERT_TRUE(profile); |
| 54 bookmark_model_ = BookmarkModelFactory::GetForProfile(profile); | 54 bookmark_model_ = BookmarkModelFactory::GetForProfile(profile); |
| 55 ASSERT_TRUE(bookmark_model_); | 55 ASSERT_TRUE(bookmark_model_); |
| 56 | 56 |
| 57 // Create the directory for history database. | 57 // Create the directory for history database. |
| 58 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 58 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 59 FilePath history_db_name = temp_dir_.path().AppendASCII( | 59 FilePath history_db_name = temp_dir_.path().AppendASCII( |
| 60 chrome::kHistoryFilename); | 60 chrome::kHistoryFilename); |
| 61 history_db_.Init(history_db_name, temp_dir_.path()); | 61 history_db_.Init(history_db_name); |
| 62 } | 62 } |
| 63 | 63 |
| 64 // Runs the MessageLoopForUI, and return till all pending messages were | 64 // Runs the MessageLoopForUI, and return till all pending messages were |
| 65 // processed. | 65 // processed. |
| 66 void RunMessageLoopForUI() { | 66 void RunMessageLoopForUI() { |
| 67 content::RunAllPendingInMessageLoop(); | 67 content::RunAllPendingInMessageLoop(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 TestingProfileManager profile_manager_; | 70 TestingProfileManager profile_manager_; |
| 71 BookmarkModel* bookmark_model_; | 71 BookmarkModel* bookmark_model_; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 id_row.url = url1; | 244 id_row.url = url1; |
| 245 id_rows.clear(); | 245 id_rows.clear(); |
| 246 id_rows.push_back(id_row); | 246 id_rows.push_back(id_row); |
| 247 ASSERT_TRUE(handler.Delete(id_rows)); | 247 ASSERT_TRUE(handler.Delete(id_rows)); |
| 248 RunMessageLoopForUI(); | 248 RunMessageLoopForUI(); |
| 249 // All bookmarks were deleted. | 249 // All bookmarks were deleted. |
| 250 EXPECT_FALSE(bookmark_model_->HasBookmarks()); | 250 EXPECT_FALSE(bookmark_model_->HasBookmarks()); |
| 251 } | 251 } |
| 252 | 252 |
| 253 } // namespace history | 253 } // namespace history |
| OLD | NEW |