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

Side by Side 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, 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/extensions/extension_content_settings_store.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 TEST(ExtensionContentSettingsStore, Register) {
10 ExtensionContentSettingsStore map;
11 map.RegisterExtension("TestId", base::Time::Now(), true);
12 }
13
14 TEST(ExtensionContentSettingsStore, YYY) {
15 ExtensionContentSettingsStore map;
16
17 EXPECT_EQ(CONTENT_SETTING_DEFAULT,
18 map.GetEffectiveContentSetting(
19 GURL("http://www.youtube.com"),
20 GURL("http://www.youtube.com"),
21 CONTENT_SETTINGS_TYPE_COOKIES,
22 "",
23 false));
24
25 // Register first extension
26 std::string ext_id("my_extension");
27 base::Time time_1 = base::Time::Now(); // TODO spec a time!!!!
28 map.RegisterExtension(ext_id, time_1, true);
29
30 EXPECT_EQ(CONTENT_SETTING_DEFAULT,
31 map.GetEffectiveContentSetting(
32 GURL("http://www.youtube.com"),
33 GURL("http://www.youtube.com"),
34 CONTENT_SETTINGS_TYPE_COOKIES,
35 "",
36 false));
37
38 // Set setting
39 ContentSettingsPattern pattern =
40 ContentSettingsPattern::FromString("http://www.youtube.com");
41 map.SetExtensionContentSetting(
42 ext_id,
43 pattern,
44 pattern,
45 CONTENT_SETTINGS_TYPE_COOKIES,
46 "",
47 CONTENT_SETTING_ALLOW,
48 false);
49
50 EXPECT_EQ(CONTENT_SETTING_ALLOW,
51 map.GetEffectiveContentSetting(
52 GURL("http://www.youtube.com"),
53 GURL("http://www.youtube.com"),
54 CONTENT_SETTINGS_TYPE_COOKIES,
55 "",
56 false));
57
58 // Register second extension
59 std::string ext_id_2("my_second_extension");
60 base::Time time_2 = base::Time::Now(); // TODO spec a time!!!! FromDoubleT(10 00);
61 map.RegisterExtension(ext_id_2, time_2, true);
62 map.SetExtensionContentSetting(
63 ext_id_2,
64 pattern,
65 pattern,
66 CONTENT_SETTINGS_TYPE_COOKIES,
67 "",
68 CONTENT_SETTING_BLOCK,
69 false);
70
71 EXPECT_EQ(CONTENT_SETTING_BLOCK,
72 map.GetEffectiveContentSetting(
73 GURL("http://www.youtube.com"),
74 GURL("http://www.youtube.com"),
75 CONTENT_SETTINGS_TYPE_COOKIES,
76 "",
77 false));
78 }
OLDNEW
« 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