| 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/autocomplete/shortcuts_backend.h" | 5 #include "chrome/browser/autocomplete/shortcuts_backend.h" |
| 6 | 6 |
| 7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 changed_notified_ = changed_notified; | 47 changed_notified_ = changed_notified; |
| 48 } | 48 } |
| 49 | 49 |
| 50 void InitBackend(); | 50 void InitBackend(); |
| 51 bool AddShortcut(const ShortcutsDatabase::Shortcut& shortcut); | 51 bool AddShortcut(const ShortcutsDatabase::Shortcut& shortcut); |
| 52 bool UpdateShortcut(const ShortcutsDatabase::Shortcut& shortcut); | 52 bool UpdateShortcut(const ShortcutsDatabase::Shortcut& shortcut); |
| 53 bool DeleteShortcutsWithURL(const GURL& url); | 53 bool DeleteShortcutsWithURL(const GURL& url); |
| 54 bool DeleteShortcutsWithIDs( | 54 bool DeleteShortcutsWithIDs( |
| 55 const ShortcutsDatabase::ShortcutIDs& deleted_ids); | 55 const ShortcutsDatabase::ShortcutIDs& deleted_ids); |
| 56 | 56 |
| 57 private: |
| 58 base::MessageLoopForUI ui_message_loop_; |
| 59 content::TestBrowserThread ui_thread_; |
| 60 content::TestBrowserThread db_thread_; |
| 61 |
| 57 protected: | 62 protected: |
| 58 TestingProfile profile_; | 63 TestingProfile profile_; |
| 59 | 64 |
| 60 private: | 65 private: |
| 61 scoped_refptr<ShortcutsBackend> backend_; | 66 scoped_refptr<ShortcutsBackend> backend_; |
| 62 base::MessageLoopForUI ui_message_loop_; | |
| 63 content::TestBrowserThread ui_thread_; | |
| 64 content::TestBrowserThread db_thread_; | |
| 65 | 67 |
| 66 bool load_notified_; | 68 bool load_notified_; |
| 67 bool changed_notified_; | 69 bool changed_notified_; |
| 68 | 70 |
| 69 DISALLOW_COPY_AND_ASSIGN(ShortcutsBackendTest); | 71 DISALLOW_COPY_AND_ASSIGN(ShortcutsBackendTest); |
| 70 }; | 72 }; |
| 71 | 73 |
| 72 ShortcutsBackendTest::ShortcutsBackendTest() | 74 ShortcutsBackendTest::ShortcutsBackendTest() |
| 73 : ui_thread_(content::BrowserThread::UI, &ui_message_loop_), | 75 : ui_thread_(content::BrowserThread::UI, &ui_message_loop_), |
| 74 db_thread_(content::BrowserThread::DB), | 76 db_thread_(content::BrowserThread::DB), |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 ASSERT_TRUE(shortcut4_iter != shortcuts_map().end()); | 309 ASSERT_TRUE(shortcut4_iter != shortcuts_map().end()); |
| 308 EXPECT_EQ(shortcut4.id, shortcut4_iter->second.id); | 310 EXPECT_EQ(shortcut4.id, shortcut4_iter->second.id); |
| 309 | 311 |
| 310 ShortcutsDatabase::ShortcutIDs deleted_ids; | 312 ShortcutsDatabase::ShortcutIDs deleted_ids; |
| 311 deleted_ids.push_back(shortcut3.id); | 313 deleted_ids.push_back(shortcut3.id); |
| 312 deleted_ids.push_back(shortcut4.id); | 314 deleted_ids.push_back(shortcut4.id); |
| 313 EXPECT_TRUE(DeleteShortcutsWithIDs(deleted_ids)); | 315 EXPECT_TRUE(DeleteShortcutsWithIDs(deleted_ids)); |
| 314 | 316 |
| 315 ASSERT_EQ(0U, shortcuts_map().size()); | 317 ASSERT_EQ(0U, shortcuts_map().size()); |
| 316 } | 318 } |
| OLD | NEW |