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

Side by Side Diff: chrome/browser/extensions/api/content_settings/content_settings_apitest.cc

Issue 880223002: Expose microphone content setting to extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed the term "main-frame" from the description. ( and rebase over 883983003 which did that elsewhere) Created 5 years, 10 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
OLDNEW
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/prefs/pref_service.h" 5 #include "base/prefs/pref_service.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "chrome/browser/browser_process.h" 7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/content_settings/cookie_settings.h" 9 #include "chrome/browser/content_settings/cookie_settings.h"
10 #include "chrome/browser/extensions/api/content_settings/content_settings_api.h" 10 #include "chrome/browser/extensions/api/content_settings/content_settings_api.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 EXPECT_EQ(CONTENT_SETTING_ASK, 104 EXPECT_EQ(CONTENT_SETTING_ASK,
105 map->GetContentSetting(example_url, 105 map->GetContentSetting(example_url,
106 example_url, 106 example_url,
107 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, 107 CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
108 std::string())); 108 std::string()));
109 EXPECT_EQ(CONTENT_SETTING_ASK, 109 EXPECT_EQ(CONTENT_SETTING_ASK,
110 map->GetContentSetting(example_url, 110 map->GetContentSetting(example_url,
111 example_url, 111 example_url,
112 CONTENT_SETTINGS_TYPE_MOUSELOCK, 112 CONTENT_SETTINGS_TYPE_MOUSELOCK,
113 std::string())); 113 std::string()));
114 EXPECT_EQ(CONTENT_SETTING_ASK,
115 map->GetContentSetting(example_url,
116 example_url,
117 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
118 std::string()));
114 119
115 // Check content settings for www.google.com 120 // Check content settings for www.google.com
116 GURL url("http://www.google.com"); 121 GURL url("http://www.google.com");
117 EXPECT_FALSE(cookie_settings->IsReadingCookieAllowed(url, url)); 122 EXPECT_FALSE(cookie_settings->IsReadingCookieAllowed(url, url));
118 EXPECT_EQ(CONTENT_SETTING_ALLOW, 123 EXPECT_EQ(CONTENT_SETTING_ALLOW,
119 map->GetContentSetting( 124 map->GetContentSetting(
120 url, url, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); 125 url, url, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
121 EXPECT_EQ(CONTENT_SETTING_BLOCK, 126 EXPECT_EQ(CONTENT_SETTING_BLOCK,
122 map->GetContentSetting( 127 map->GetContentSetting(
123 url, url, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); 128 url, url, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string()));
124 EXPECT_EQ(CONTENT_SETTING_BLOCK, 129 EXPECT_EQ(CONTENT_SETTING_BLOCK,
125 map->GetContentSetting( 130 map->GetContentSetting(
126 url, url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string())); 131 url, url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string()));
127 EXPECT_EQ(CONTENT_SETTING_ALLOW, 132 EXPECT_EQ(CONTENT_SETTING_ALLOW,
128 map->GetContentSetting( 133 map->GetContentSetting(
129 url, url, CONTENT_SETTINGS_TYPE_POPUPS, std::string())); 134 url, url, CONTENT_SETTINGS_TYPE_POPUPS, std::string()));
130 EXPECT_EQ(CONTENT_SETTING_BLOCK, 135 EXPECT_EQ(CONTENT_SETTING_BLOCK,
131 map->GetContentSetting( 136 map->GetContentSetting(
132 url, url, CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string())); 137 url, url, CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()));
133 EXPECT_EQ( 138 EXPECT_EQ(
134 CONTENT_SETTING_BLOCK, 139 CONTENT_SETTING_BLOCK,
135 map->GetContentSetting( 140 map->GetContentSetting(
136 url, url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string())); 141 url, url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string()));
137 EXPECT_EQ(CONTENT_SETTING_BLOCK, 142 EXPECT_EQ(CONTENT_SETTING_BLOCK,
138 map->GetContentSetting( 143 map->GetContentSetting(
139 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string())); 144 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()));
145 EXPECT_EQ(CONTENT_SETTING_BLOCK,
146 map->GetContentSetting(
147 url, url, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, std::string()));
140 } 148 }
141 149
142 void CheckContentSettingsDefault() { 150 void CheckContentSettingsDefault() {
143 HostContentSettingsMap* map = 151 HostContentSettingsMap* map =
144 profile_->GetHostContentSettingsMap(); 152 profile_->GetHostContentSettingsMap();
145 CookieSettings* cookie_settings = 153 CookieSettings* cookie_settings =
146 CookieSettings::Factory::GetForProfile(profile_).get(); 154 CookieSettings::Factory::GetForProfile(profile_).get();
147 155
148 // Check content settings for www.google.com 156 // Check content settings for www.google.com
149 GURL url("http://www.google.com"); 157 GURL url("http://www.google.com");
(...skipping 15 matching lines...) Expand all
165 EXPECT_EQ(CONTENT_SETTING_ASK, 173 EXPECT_EQ(CONTENT_SETTING_ASK,
166 map->GetContentSetting( 174 map->GetContentSetting(
167 url, url, CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string())); 175 url, url, CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()));
168 EXPECT_EQ( 176 EXPECT_EQ(
169 CONTENT_SETTING_ASK, 177 CONTENT_SETTING_ASK,
170 map->GetContentSetting( 178 map->GetContentSetting(
171 url, url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string())); 179 url, url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string()));
172 EXPECT_EQ(CONTENT_SETTING_ASK, 180 EXPECT_EQ(CONTENT_SETTING_ASK,
173 map->GetContentSetting( 181 map->GetContentSetting(
174 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string())); 182 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()));
183 EXPECT_EQ(CONTENT_SETTING_ASK,
184 map->GetContentSetting(
185 url, url, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, std::string()));
175 } 186 }
176 187
177 private: 188 private:
178 Profile* profile_; 189 Profile* profile_;
179 }; 190 };
180 191
181 // http://crbug.com/177163 192 // http://crbug.com/177163
182 #if defined(OS_WIN) && !defined(NDEBUG) 193 #if defined(OS_WIN) && !defined(NDEBUG)
183 #define MAYBE_Standard DISABLED_Standard 194 #define MAYBE_Standard DISABLED_Standard
184 #else 195 #else
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 base::FilePath(kBarPath), 240 base::FilePath(kBarPath),
230 base::ASCIIToUTF16("2.3.4"), 241 base::ASCIIToUTF16("2.3.4"),
231 base::ASCIIToUTF16("bar")), 242 base::ASCIIToUTF16("bar")),
232 false); 243 false);
233 244
234 EXPECT_TRUE(RunExtensionTest("content_settings/getresourceidentifiers")) 245 EXPECT_TRUE(RunExtensionTest("content_settings/getresourceidentifiers"))
235 << message_; 246 << message_;
236 } 247 }
237 248
238 } // namespace extensions 249 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698