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

Unified Diff: chrome/browser/content_settings/content_settings_origin_identifier_value_map_unittest.cc

Issue 7049007: Origin Identifier Value Map. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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/content_settings/content_settings_origin_identifier_value_map_unittest.cc
diff --git a/chrome/browser/content_settings/content_settings_origin_identifier_value_map_unittest.cc b/chrome/browser/content_settings/content_settings_origin_identifier_value_map_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bc75c951ab9c030757e747387db039cc3a1bacea
--- /dev/null
+++ b/chrome/browser/content_settings/content_settings_origin_identifier_value_map_unittest.cc
@@ -0,0 +1,83 @@
+// 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/content_settings/content_settings_origin_identifier_value_map.h"
+
+#include "base/scoped_ptr.h"
+#include "base/values.h"
+#include "googleurl/src/gurl.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+TEST(OriginIdentifierValueMapTest, GetSetValues) {
+ content_settings::OriginIdentifierValueMap map;
+
+ scoped_ptr<Value> expected_value(Value::CreateNullValue());
+ scoped_ptr<Value> actual_value(map.GetValue(GURL("http://www.google.com"),
+ GURL("http://www.google.com"),
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ ""));
+ EXPECT_TRUE(expected_value->Equals(actual_value.get()));
+ map.SetValue(
+ ContentSettingsPattern::FromString("[*.]google.com"),
+ ContentSettingsPattern::FromString("[*.]google.com"),
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ "",
+ Value::CreateIntegerValue(1));
+ expected_value.reset(Value::CreateIntegerValue(1));
+ actual_value.reset(map.GetValue(GURL("http://www.google.com"),
+ GURL("http://www.google.com"),
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ ""));
+ EXPECT_TRUE(expected_value->Equals(actual_value.get()));
+/*
+ EXPECT_EQ(CONTENT_SETTING_DEFAULT,
+ map.GetContentSetting(
+ GURL("http://www.google.com"),
+ GURL("http://www.youtube.com"),
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ ""));
+
+ EXPECT_EQ(CONTENT_SETTING_DEFAULT,
+ map.GetContentSetting(
+ GURL("http://www.youtube.com"),
+ GURL("http://www.google.com"),
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ ""));
+
+ EXPECT_EQ(CONTENT_SETTING_DEFAULT,
+ map.GetContentSetting(
+ GURL("http://www.google.com"),
+ GURL("http://www.google.com"),
+ CONTENT_SETTINGS_TYPE_POPUPS,
+ ""));
+
+ EXPECT_EQ(CONTENT_SETTING_DEFAULT,
+ map.GetContentSetting(
+ GURL("http://www.google.com"),
+ GURL("http://www.google.com"),
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ "resource_id"));
+
+ map.UpdateContentSetting(
+ ContentSettingsPattern::FromString("www.google.com"),
+ ContentSettingsPattern::FromString("[*.]google.com"),
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ "",
+ CONTENT_SETTING_ALLOW);
+
+ EXPECT_EQ(CONTENT_SETTING_BLOCK,
+ map.GetContentSetting(
+ GURL("http://mail.google.com"),
+ GURL("http://www.google.com"),
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ ""));
+
+ EXPECT_EQ(CONTENT_SETTING_ALLOW,
+ map.GetContentSetting(
+ GURL("http://www.google.com"),
+ GURL("http://www.google.com"),
+ CONTENT_SETTINGS_TYPE_COOKIES,
+ ""));
+ */
+}

Powered by Google App Engine
This is Rietveld 408576698