OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/extensions/app_notification_manager.h" | 6 #include "chrome/browser/extensions/app_notification_manager.h" |
7 #include "chrome/browser/extensions/app_notification_test_util.h" | 7 #include "chrome/browser/extensions/app_notification_test_util.h" |
8 #include "chrome/common/extensions/extension.h" | 8 #include "chrome/common/extensions/extension.h" |
9 #include "chrome/common/extensions/extension_test_util.h" | 9 #include "chrome/common/extensions/extension_test_util.h" |
10 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
11 #include "chrome/test/base/testing_profile.h" | 11 #include "chrome/test/base/testing_profile.h" |
12 #include "content/common/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
13 #include "content/public/browser/notification_details.h" | 13 #include "content/public/browser/notification_details.h" |
14 #include "content/public/browser/notification_source.h" | 14 #include "content/public/browser/notification_source.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 | 16 |
17 namespace util = app_notification_test_util; | 17 namespace util = app_notification_test_util; |
18 | 18 |
19 class AppNotificationManagerTest : public testing::Test { | 19 class AppNotificationManagerTest : public testing::Test { |
20 public: | 20 public: |
21 AppNotificationManagerTest() | 21 AppNotificationManagerTest() |
22 : ui_thread_(BrowserThread::UI, &ui_loop_), | 22 : ui_thread_(BrowserThread::UI, &ui_loop_), |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 AppNotificationList list1; | 102 AppNotificationList list1; |
103 AppNotificationList list2; | 103 AppNotificationList list2; |
104 util::AddNotifications(&list1, 5, "foo1"); | 104 util::AddNotifications(&list1, 5, "foo1"); |
105 util::AddNotifications(&list2, 3, "foo2"); | 105 util::AddNotifications(&list2, 3, "foo2"); |
106 util::AddCopiesFromList(mgr_.get(), id1, list1); | 106 util::AddCopiesFromList(mgr_.get(), id1, list1); |
107 util::AddCopiesFromList(mgr_.get(), id2, list2); | 107 util::AddCopiesFromList(mgr_.get(), id2, list2); |
108 util::ExpectListsEqual(list1, *mgr_->GetAll(id1)); | 108 util::ExpectListsEqual(list1, *mgr_->GetAll(id1)); |
109 util::ExpectListsEqual(list2, *mgr_->GetAll(id2)); | 109 util::ExpectListsEqual(list2, *mgr_->GetAll(id2)); |
110 | 110 |
111 // Send the uninstall notification for extension id1. | 111 // Send the uninstall notification for extension id1. |
112 NotificationService::current()->Notify( | 112 content::NotificationService::current()->Notify( |
113 chrome::NOTIFICATION_EXTENSION_UNINSTALLED, | 113 chrome::NOTIFICATION_EXTENSION_UNINSTALLED, |
114 content::Source<Profile>(profile_.get()), | 114 content::Source<Profile>(profile_.get()), |
115 content::Details<const std::string>(&id1)); | 115 content::Details<const std::string>(&id1)); |
116 | 116 |
117 // The id1 items should be gone but the id2 items should still be there. | 117 // The id1 items should be gone but the id2 items should still be there. |
118 EXPECT_EQ(NULL, mgr_->GetLast(id1)); | 118 EXPECT_EQ(NULL, mgr_->GetLast(id1)); |
119 EXPECT_EQ(NULL, mgr_->GetAll(id1)); | 119 EXPECT_EQ(NULL, mgr_->GetAll(id1)); |
120 util::ExpectListsEqual(list2, *mgr_->GetAll(id2)); | 120 util::ExpectListsEqual(list2, *mgr_->GetAll(id2)); |
121 } | 121 } |
OLD | NEW |