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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "chrome/browser/extensions/app_notification_manager.h" | 7 #include "chrome/browser/extensions/app_notification_manager.h" |
8 #include "chrome/browser/extensions/app_notification_test_util.h" | 8 #include "chrome/browser/extensions/app_notification_test_util.h" |
9 #include "chrome/common/chrome_notification_types.h" | 9 #include "chrome/common/chrome_notification_types.h" |
10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 static void WaitForFileThread() { | 63 static void WaitForFileThread() { |
64 BrowserThread::PostTask(BrowserThread::FILE, | 64 BrowserThread::PostTask(BrowserThread::FILE, |
65 FROM_HERE, | 65 FROM_HERE, |
66 base::Bind(&PostQuitToUIThread)); | 66 base::Bind(&PostQuitToUIThread)); |
67 MessageLoop::current()->Run(); | 67 MessageLoop::current()->Run(); |
68 } | 68 } |
69 | 69 |
70 MessageLoop ui_loop_; | 70 MessageLoop ui_loop_; |
71 content::TestBrowserThread ui_thread_; | 71 content::TestBrowserThread ui_thread_; |
72 content::TestBrowserThread file_thread_; | 72 content::TestBrowserThread file_thread_; |
73 ScopedTempDir temp_dir_; | 73 base::ScopedTempDir temp_dir_; |
74 scoped_ptr<TestingProfile> profile_; | 74 scoped_ptr<TestingProfile> profile_; |
75 scoped_refptr<AppNotificationManager> mgr_; | 75 scoped_refptr<AppNotificationManager> mgr_; |
76 }; | 76 }; |
77 | 77 |
78 TEST_F(AppNotificationManagerTest, Simple) { | 78 TEST_F(AppNotificationManagerTest, Simple) { |
79 std::string id = extension_test_util::MakeId("whatever"); | 79 std::string id = extension_test_util::MakeId("whatever"); |
80 AppNotificationList list; | 80 AppNotificationList list; |
81 util::AddNotifications(&list, id, 2, "foo"); | 81 util::AddNotifications(&list, id, 2, "foo"); |
82 EXPECT_TRUE(util::AddCopiesFromList(mgr_.get(), list)); | 82 EXPECT_TRUE(util::AddCopiesFromList(mgr_.get(), list)); |
83 | 83 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 content::Source<Profile>(profile_.get()), | 123 content::Source<Profile>(profile_.get()), |
124 content::Details<const Extension>(extension1.get())); | 124 content::Details<const Extension>(extension1.get())); |
125 | 125 |
126 // The id1 items should be gone but the id2 items should still be there. | 126 // The id1 items should be gone but the id2 items should still be there. |
127 EXPECT_EQ(NULL, mgr_->GetLast(id1)); | 127 EXPECT_EQ(NULL, mgr_->GetLast(id1)); |
128 EXPECT_EQ(NULL, mgr_->GetAll(id1)); | 128 EXPECT_EQ(NULL, mgr_->GetAll(id1)); |
129 util::ExpectListsEqual(list2, *mgr_->GetAll(id2)); | 129 util::ExpectListsEqual(list2, *mgr_->GetAll(id2)); |
130 } | 130 } |
131 | 131 |
132 } // namespace extensions | 132 } // namespace extensions |
OLD | NEW |