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

Side by Side Diff: chrome/browser/content_settings/tab_specific_content_settings_unittest.cc

Issue 7558024: Add UMA metrics for blocked plugins. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 9 years, 4 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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/content_settings/tab_specific_content_settings.h" 5 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
6 #include "chrome/test/base/testing_profile.h" 6 #include "chrome/test/base/testing_profile.h"
7 #include "content/browser/browser_thread.h" 7 #include "content/browser/browser_thread.h"
8 #include "content/browser/renderer_host/test_render_view_host.h" 8 #include "content/browser/renderer_host/test_render_view_host.h"
9 #include "content/browser/tab_contents/test_tab_contents.h" 9 #include "content/browser/tab_contents/test_tab_contents.h"
10 #include "net/base/cookie_monster.h" 10 #include "net/base/cookie_monster.h"
(...skipping 22 matching lines...) Expand all
33 EXPECT_FALSE( 33 EXPECT_FALSE(
34 content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_PLUGINS)); 34 content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_PLUGINS));
35 EXPECT_FALSE( 35 EXPECT_FALSE(
36 content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES)); 36 content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES));
37 EXPECT_FALSE(content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_POPUPS)); 37 EXPECT_FALSE(content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_POPUPS));
38 38
39 // Set a cookie, block access to images, block a popup. 39 // Set a cookie, block access to images, block a popup.
40 content_settings.OnCookieChanged( 40 content_settings.OnCookieChanged(
41 GURL("http://google.com"), "A=B", options, false); 41 GURL("http://google.com"), "A=B", options, false);
42 content_settings.OnContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES, 42 content_settings.OnContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES,
43 std::string()); 43 std::string(), CONTENT_SETTING_BLOCK);
44 content_settings.SetPopupsBlocked(true); 44 content_settings.SetPopupsBlocked(true);
45 45
46 // Check that only the respective content types are affected. 46 // Check that only the respective content types are affected.
47 EXPECT_TRUE(content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES)); 47 EXPECT_TRUE(content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES));
48 EXPECT_FALSE( 48 EXPECT_FALSE(
49 content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_JAVASCRIPT)); 49 content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_JAVASCRIPT));
50 EXPECT_FALSE( 50 EXPECT_FALSE(
51 content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_PLUGINS)); 51 content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_PLUGINS));
52 EXPECT_FALSE( 52 EXPECT_FALSE(
53 content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES)); 53 content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES));
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 content_settings.IsContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES)); 128 content_settings.IsContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES));
129 ASSERT_FALSE( 129 ASSERT_FALSE(
130 content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES)); 130 content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES));
131 content_settings.OnCookiesRead( 131 content_settings.OnCookiesRead(
132 GURL("http://google.com"), net::CookieList(), true); 132 GURL("http://google.com"), net::CookieList(), true);
133 ASSERT_FALSE( 133 ASSERT_FALSE(
134 content_settings.IsContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES)); 134 content_settings.IsContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES));
135 ASSERT_FALSE( 135 ASSERT_FALSE(
136 content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES)); 136 content_settings.IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES));
137 } 137 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698