| 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/strings/string16.h" | 5 #include "base/strings/string16.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 EXPECT_FALSE(content_settings->IsContentBlocked( | 65 EXPECT_FALSE(content_settings->IsContentBlocked( |
| 66 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); | 66 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); |
| 67 | 67 |
| 68 // Set a cookie, block access to images, block mediastream access and block a | 68 // Set a cookie, block access to images, block mediastream access and block a |
| 69 // popup. | 69 // popup. |
| 70 content_settings->OnCookieChanged(GURL("http://google.com"), | 70 content_settings->OnCookieChanged(GURL("http://google.com"), |
| 71 GURL("http://google.com"), | 71 GURL("http://google.com"), |
| 72 "A=B", | 72 "A=B", |
| 73 options, | 73 options, |
| 74 false); | 74 false); |
| 75 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES, | 75 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES); |
| 76 std::string()); | |
| 77 content_settings->SetPopupsBlocked(true); | 76 content_settings->SetPopupsBlocked(true); |
| 78 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, | 77 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); |
| 79 std::string()); | 78 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
| 80 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, | |
| 81 std::string()); | |
| 82 | 79 |
| 83 // Check that only the respective content types are affected. | 80 // Check that only the respective content types are affected. |
| 84 EXPECT_TRUE(content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES)); | 81 EXPECT_TRUE(content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES)); |
| 85 EXPECT_FALSE( | 82 EXPECT_FALSE( |
| 86 content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_JAVASCRIPT)); | 83 content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_JAVASCRIPT)); |
| 87 EXPECT_FALSE( | 84 EXPECT_FALSE( |
| 88 content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_PLUGINS)); | 85 content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_PLUGINS)); |
| 89 EXPECT_FALSE( | 86 EXPECT_FALSE( |
| 90 content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES)); | 87 content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES)); |
| 91 EXPECT_TRUE(content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_POPUPS)); | 88 EXPECT_TRUE(content_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_POPUPS)); |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 UTF8ToUTF16("text"), | 373 UTF8ToUTF16("text"), |
| 377 blocked_by_policy); | 374 blocked_by_policy); |
| 378 content_settings->OnLocalStorageAccessed(GURL("http://google.com"), | 375 content_settings->OnLocalStorageAccessed(GURL("http://google.com"), |
| 379 true, | 376 true, |
| 380 blocked_by_policy); | 377 blocked_by_policy); |
| 381 content_settings->OnWebDatabaseAccessed(GURL("http://google.com"), | 378 content_settings->OnWebDatabaseAccessed(GURL("http://google.com"), |
| 382 UTF8ToUTF16("name"), | 379 UTF8ToUTF16("name"), |
| 383 UTF8ToUTF16("display_name"), | 380 UTF8ToUTF16("display_name"), |
| 384 blocked_by_policy); | 381 blocked_by_policy); |
| 385 } | 382 } |
| OLD | NEW |