Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Unified Diff: extensions/browser/info_map_unittest.cc

Issue 61323002: Fix broken threading model in CheckDesktopNotificationPermission (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Even more merge conflicts.. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/browser/info_map.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/info_map_unittest.cc
diff --git a/extensions/browser/info_map_unittest.cc b/extensions/browser/info_map_unittest.cc
index 5136069aaa52be0df69cc6745601153e34dc52b4..b023eed152c1830531a71fbd6731d5fbbf845e49 100644
--- a/extensions/browser/info_map_unittest.cc
+++ b/extensions/browser/info_map_unittest.cc
@@ -90,9 +90,9 @@ TEST_F(InfoMapTest, RefCounting) {
EXPECT_TRUE(extension3->HasOneRef());
// Add a ref to each extension and give it to the info map.
- info_map->AddExtension(extension1.get(), base::Time(), false);
- info_map->AddExtension(extension2.get(), base::Time(), false);
- info_map->AddExtension(extension3.get(), base::Time(), false);
+ info_map->AddExtension(extension1.get(), base::Time(), false, false);
+ info_map->AddExtension(extension2.get(), base::Time(), false, false);
+ info_map->AddExtension(extension3.get(), base::Time(), false, false);
// Release extension1, and the info map should have the only ref.
const Extension* weak_extension1 = extension1.get();
@@ -116,8 +116,8 @@ TEST_F(InfoMapTest, Properties) {
scoped_refptr<Extension> extension1(CreateExtension("extension1"));
scoped_refptr<Extension> extension2(CreateExtension("extension2"));
- info_map->AddExtension(extension1.get(), base::Time(), false);
- info_map->AddExtension(extension2.get(), base::Time(), false);
+ info_map->AddExtension(extension1.get(), base::Time(), false, false);
+ info_map->AddExtension(extension2.get(), base::Time(), false, false);
EXPECT_EQ(2u, info_map->extensions().size());
EXPECT_EQ(extension1.get(), info_map->extensions().GetByID(extension1->id()));
@@ -137,8 +137,8 @@ TEST_F(InfoMapTest, CheckPermissions) {
ASSERT_TRUE(app->is_app());
ASSERT_TRUE(app->web_extent().MatchesURL(app_url));
- info_map->AddExtension(app.get(), base::Time(), false);
- info_map->AddExtension(extension.get(), base::Time(), false);
+ info_map->AddExtension(app.get(), base::Time(), false, false);
+ info_map->AddExtension(extension.get(), base::Time(), false, false);
// The app should have the notifications permission, either from a
// chrome-extension URL or from its web extent.
@@ -161,4 +161,16 @@ TEST_F(InfoMapTest, CheckPermissions) {
EXPECT_FALSE(match);
}
+TEST_F(InfoMapTest, TestNotificationsDisabled) {
+ scoped_refptr<InfoMap> info_map(new InfoMap());
+ scoped_refptr<Extension> app(LoadManifest("manifest_tests",
+ "valid_app.json"));
+ info_map->AddExtension(app.get(), base::Time(), false, false);
+
+ EXPECT_FALSE(info_map->AreNotificationsDisabled(app->id()));
+ info_map->SetNotificationsDisabled(app->id(), true);
+ EXPECT_TRUE(info_map->AreNotificationsDisabled(app->id()));
+ info_map->SetNotificationsDisabled(app->id(), false);
+}
+
} // namespace extensions
« no previous file with comments | « extensions/browser/info_map.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698