OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/tab_contents/tab_specific_content_settings.h" | 5 #include "chrome/browser/tab_contents/tab_specific_content_settings.h" |
6 | 6 |
7 #include "chrome/test/testing_profile.h" | 7 #include "chrome/test/testing_profile.h" |
8 #include "net/base/cookie_options.h" | 8 #include "net/base/cookie_monster.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 namespace { | 11 namespace { |
12 class TestContentSettingsDelegate | 12 class TestContentSettingsDelegate |
13 : public TabSpecificContentSettings::Delegate { | 13 : public TabSpecificContentSettings::Delegate { |
14 public: | 14 public: |
15 TestContentSettingsDelegate() | 15 TestContentSettingsDelegate() |
16 : settings_changed_(false), content_blocked_(false) {} | 16 : settings_changed_(false), content_blocked_(false) {} |
17 virtual ~TestContentSettingsDelegate() {} | 17 virtual ~TestContentSettingsDelegate() {} |
18 | 18 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 content_settings.IsContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES)); | 130 content_settings.IsContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES)); |
131 ASSERT_FALSE( | 131 ASSERT_FALSE( |
132 content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES)); | 132 content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES)); |
133 content_settings.OnCookieChanged( | 133 content_settings.OnCookieChanged( |
134 GURL("http://google.com"), "C=D", options, true); | 134 GURL("http://google.com"), "C=D", options, true); |
135 ASSERT_TRUE( | 135 ASSERT_TRUE( |
136 content_settings.IsContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES)); | 136 content_settings.IsContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES)); |
137 ASSERT_TRUE( | 137 ASSERT_TRUE( |
138 content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES)); | 138 content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES)); |
139 } | 139 } |
| 140 |
| 141 TEST(TabSpecificContentSettingsTest, EmptyCookieList) { |
| 142 TestContentSettingsDelegate test_delegate; |
| 143 TestingProfile profile; |
| 144 TabSpecificContentSettings content_settings(&test_delegate, &profile); |
| 145 |
| 146 ASSERT_FALSE( |
| 147 content_settings.IsContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES)); |
| 148 ASSERT_FALSE( |
| 149 content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES)); |
| 150 content_settings.OnCookiesRead( |
| 151 GURL("http://google.com"), net::CookieList(), true); |
| 152 ASSERT_FALSE( |
| 153 content_settings.IsContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES)); |
| 154 ASSERT_FALSE( |
| 155 content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES)); |
| 156 } |
OLD | NEW |