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

Unified Diff: chrome/browser/extensions/extension_content_settings_store_unittest.cc

Issue 6927028: TODO (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 months 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
Index: chrome/browser/extensions/extension_content_settings_store_unittest.cc
diff --git a/chrome/browser/extensions/extension_content_settings_store_unittest.cc b/chrome/browser/extensions/extension_content_settings_store_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..10fb10e510869d840e41a4cae55b10cebe0b5b9e
--- /dev/null
+++ b/chrome/browser/extensions/extension_content_settings_store_unittest.cc
@@ -0,0 +1,78 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/extensions/extension_content_settings_store.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+TEST(ExtensionContentSettingsStore, Register) {
+ ExtensionContentSettingsStore map;
+ map.RegisterExtension("TestId", base::Time::Now(), true);
+}
+
+TEST(ExtensionContentSettingsStore, YYY) {
+ ExtensionContentSettingsStore map;
+
+ EXPECT_EQ(CONTENT_SETTING_DEFAULT,
+ map.GetEffectiveContentSetting(
+ GURL("http://www.youtube.com"),
+ GURL("http://www.youtube.com"),
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ "",
+ false));
+
+ // Register first extension
+ std::string ext_id("my_extension");
+ base::Time time_1 = base::Time::Now(); // TODO spec a time!!!!
+ map.RegisterExtension(ext_id, time_1, true);
+
+ EXPECT_EQ(CONTENT_SETTING_DEFAULT,
+ map.GetEffectiveContentSetting(
+ GURL("http://www.youtube.com"),
+ GURL("http://www.youtube.com"),
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ "",
+ false));
+
+ // Set setting
+ ContentSettingsPattern pattern =
+ ContentSettingsPattern::FromString("http://www.youtube.com");
+ map.SetExtensionContentSetting(
+ ext_id,
+ pattern,
+ pattern,
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ "",
+ CONTENT_SETTING_ALLOW,
+ false);
+
+ EXPECT_EQ(CONTENT_SETTING_ALLOW,
+ map.GetEffectiveContentSetting(
+ GURL("http://www.youtube.com"),
+ GURL("http://www.youtube.com"),
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ "",
+ false));
+
+ // Register second extension
+ std::string ext_id_2("my_second_extension");
+ base::Time time_2 = base::Time::Now(); // TODO spec a time!!!! FromDoubleT(1000);
+ map.RegisterExtension(ext_id_2, time_2, true);
+ map.SetExtensionContentSetting(
+ ext_id_2,
+ pattern,
+ pattern,
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ "",
+ CONTENT_SETTING_BLOCK,
+ false);
+
+ EXPECT_EQ(CONTENT_SETTING_BLOCK,
+ map.GetEffectiveContentSetting(
+ GURL("http://www.youtube.com"),
+ GURL("http://www.youtube.com"),
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ "",
+ false));
+}
« no previous file with comments | « chrome/browser/extensions/extension_content_settings_store.cc ('k') | chrome/browser/profiles/profile_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698