| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/string16.h" | 5 #include "base/string16.h" |
| 6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 7 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 8 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 8 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 9 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
| 10 #include "content/public/test/test_browser_thread.h" | 10 #include "content/public/test/test_browser_thread.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 content_settings->IsContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES)); | 180 content_settings->IsContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES)); |
| 181 ASSERT_FALSE( | 181 ASSERT_FALSE( |
| 182 content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES)); | 182 content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES)); |
| 183 | 183 |
| 184 // Record a blocked cookie. | 184 // Record a blocked cookie. |
| 185 content_settings->OnCookieChanged(GURL("http://google.com"), | 185 content_settings->OnCookieChanged(GURL("http://google.com"), |
| 186 GURL("http://google.com"), | 186 GURL("http://google.com"), |
| 187 "C=D", | 187 "C=D", |
| 188 options, | 188 options, |
| 189 true); | 189 true); |
| 190 ASSERT_FALSE( | 190 ASSERT_TRUE( |
| 191 content_settings->IsContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES)); | 191 content_settings->IsContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES)); |
| 192 ASSERT_TRUE( | 192 ASSERT_TRUE( |
| 193 content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES)); | 193 content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES)); |
| 194 | 194 |
| 195 // Allow mediastream access. | 195 // Allow mediastream access. |
| 196 content_settings->OnMediaStreamAllowed(); | 196 content_settings->OnMediaStreamAllowed(); |
| 197 ASSERT_TRUE( | 197 ASSERT_TRUE( |
| 198 content_settings->IsContentAllowed(CONTENT_SETTINGS_TYPE_MEDIASTREAM)); | 198 content_settings->IsContentAllowed(CONTENT_SETTINGS_TYPE_MEDIASTREAM)); |
| 199 ASSERT_FALSE( | 199 ASSERT_FALSE( |
| 200 content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_MEDIASTREAM)); | 200 content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_MEDIASTREAM)); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 TabSpecificContentSettings* content_settings = | 279 TabSpecificContentSettings* content_settings = |
| 280 TabSpecificContentSettings::FromWebContents(web_contents()); | 280 TabSpecificContentSettings::FromWebContents(web_contents()); |
| 281 ContentSettingsType type = CONTENT_SETTINGS_TYPE_MEDIASTREAM; | 281 ContentSettingsType type = CONTENT_SETTINGS_TYPE_MEDIASTREAM; |
| 282 content_settings->OnContentAllowed(type); | 282 content_settings->OnContentAllowed(type); |
| 283 EXPECT_TRUE(content_settings->IsContentAllowed(type)); | 283 EXPECT_TRUE(content_settings->IsContentAllowed(type)); |
| 284 EXPECT_FALSE(content_settings->IsContentBlocked(type)); | 284 EXPECT_FALSE(content_settings->IsContentBlocked(type)); |
| 285 content_settings->OnContentBlocked(type, std::string()); | 285 content_settings->OnContentBlocked(type, std::string()); |
| 286 EXPECT_TRUE(content_settings->IsContentBlocked(type)); | 286 EXPECT_TRUE(content_settings->IsContentBlocked(type)); |
| 287 EXPECT_FALSE(content_settings->IsContentAllowed(type)); | 287 EXPECT_FALSE(content_settings->IsContentAllowed(type)); |
| 288 } | 288 } |
| OLD | NEW |