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" |
11 #include "chrome/browser/history/history_database.h" | 11 #include "chrome/browser/history/history_database.h" |
12 #include "chrome/browser/profiles/profile_manager.h" | 12 #include "chrome/browser/profiles/profile_manager.h" |
13 #include "chrome/common/chrome_constants.h" | 13 #include "chrome/common/chrome_constants.h" |
14 #include "chrome/test/base/testing_browser_process.h" | 14 #include "chrome/test/base/testing_browser_process.h" |
| 15 #include "chrome/test/base/testing_profile.h" |
15 #include "chrome/test/base/testing_profile_manager.h" | 16 #include "chrome/test/base/testing_profile_manager.h" |
16 #include "chrome/test/base/testing_profile.h" | |
17 #include "chrome/test/base/ui_test_utils.h" | 17 #include "chrome/test/base/ui_test_utils.h" |
18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/test/test_browser_thread.h" | 19 #include "content/public/test/test_browser_thread.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
21 | 21 |
22 namespace history { | 22 namespace history { |
23 | 23 |
24 using content::BrowserThread; | 24 using content::BrowserThread; |
25 | 25 |
26 class BookmarkModelSQLHandlerTest : public testing::Test { | 26 class BookmarkModelSQLHandlerTest : public testing::Test { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_; |
72 MessageLoopForUI message_loop_; | 72 MessageLoopForUI message_loop_; |
73 content::TestBrowserThread ui_thread_; | 73 content::TestBrowserThread ui_thread_; |
74 content::TestBrowserThread file_thread_; | 74 content::TestBrowserThread file_thread_; |
75 ScopedTempDir temp_dir_; | 75 base::ScopedTempDir temp_dir_; |
76 HistoryDatabase history_db_; | 76 HistoryDatabase history_db_; |
77 }; | 77 }; |
78 | 78 |
79 TEST_F(BookmarkModelSQLHandlerTest, InsertIntoMobileFolder) { | 79 TEST_F(BookmarkModelSQLHandlerTest, InsertIntoMobileFolder) { |
80 HistoryAndBookmarkRow row; | 80 HistoryAndBookmarkRow row; |
81 row.set_raw_url("http://bookmark.com"); | 81 row.set_raw_url("http://bookmark.com"); |
82 row.set_url(GURL("http://bookmark.com")); | 82 row.set_url(GURL("http://bookmark.com")); |
83 row.set_title(UTF8ToUTF16("Bookmark Title")); | 83 row.set_title(UTF8ToUTF16("Bookmark Title")); |
84 row.set_is_bookmark(true); | 84 row.set_is_bookmark(true); |
85 | 85 |
(...skipping 158 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 |