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

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

Issue 1906533002: Add 'autoplay' content settings and expose it to Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 <memory> 5 #include <memory>
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 EXPECT_EQ(CONTENT_SETTING_ASK, 129 EXPECT_EQ(CONTENT_SETTING_ASK,
130 map->GetContentSetting(example_url, 130 map->GetContentSetting(example_url,
131 example_url, 131 example_url,
132 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, 132 CONTENT_SETTINGS_TYPE_PPAPI_BROKER,
133 std::string())); 133 std::string()));
134 EXPECT_EQ(CONTENT_SETTING_ASK, 134 EXPECT_EQ(CONTENT_SETTING_ASK,
135 map->GetContentSetting(example_url, 135 map->GetContentSetting(example_url,
136 example_url, 136 example_url,
137 CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, 137 CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS,
138 std::string())); 138 std::string()));
139 EXPECT_EQ(CONTENT_SETTING_ALLOW,
140 map->GetContentSetting(example_url,
141 example_url,
142 CONTENT_SETTINGS_TYPE_AUTOPLAY,
143 std::string()));
139 144
140 // Check content settings for www.google.com 145 // Check content settings for www.google.com
141 GURL url("http://www.google.com"); 146 GURL url("http://www.google.com");
142 EXPECT_FALSE(cookie_settings->IsReadingCookieAllowed(url, url)); 147 EXPECT_FALSE(cookie_settings->IsReadingCookieAllowed(url, url));
143 EXPECT_EQ(CONTENT_SETTING_ALLOW, 148 EXPECT_EQ(CONTENT_SETTING_ALLOW,
144 map->GetContentSetting( 149 map->GetContentSetting(
145 url, url, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); 150 url, url, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
146 EXPECT_EQ(CONTENT_SETTING_BLOCK, 151 EXPECT_EQ(CONTENT_SETTING_BLOCK,
147 map->GetContentSetting( 152 map->GetContentSetting(
148 url, url, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); 153 url, url, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string()));
(...skipping 22 matching lines...) Expand all
171 EXPECT_EQ(CONTENT_SETTING_BLOCK, 176 EXPECT_EQ(CONTENT_SETTING_BLOCK,
172 map->GetContentSetting( 177 map->GetContentSetting(
173 url, url, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, std::string())); 178 url, url, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, std::string()));
174 EXPECT_EQ(CONTENT_SETTING_BLOCK, 179 EXPECT_EQ(CONTENT_SETTING_BLOCK,
175 map->GetContentSetting( 180 map->GetContentSetting(
176 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string())); 181 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string()));
177 EXPECT_EQ(CONTENT_SETTING_BLOCK, 182 EXPECT_EQ(CONTENT_SETTING_BLOCK,
178 map->GetContentSetting( 183 map->GetContentSetting(
179 url, url, CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, 184 url, url, CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS,
180 std::string())); 185 std::string()));
186 EXPECT_EQ(CONTENT_SETTING_ALLOW,
187 map->GetContentSetting(
188 url, url, CONTENT_SETTINGS_TYPE_AUTOPLAY, std::string()));
181 } 189 }
182 190
183 void CheckContentSettingsDefault() { 191 void CheckContentSettingsDefault() {
184 HostContentSettingsMap* map = 192 HostContentSettingsMap* map =
185 HostContentSettingsMapFactory::GetForProfile(profile_); 193 HostContentSettingsMapFactory::GetForProfile(profile_);
186 content_settings::CookieSettings* cookie_settings = 194 content_settings::CookieSettings* cookie_settings =
187 CookieSettingsFactory::GetForProfile(profile_).get(); 195 CookieSettingsFactory::GetForProfile(profile_).get();
188 196
189 // Check content settings for www.google.com 197 // Check content settings for www.google.com
190 GURL url("http://www.google.com"); 198 GURL url("http://www.google.com");
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 EXPECT_EQ(CONTENT_SETTING_ASK, 230 EXPECT_EQ(CONTENT_SETTING_ASK,
223 map->GetContentSetting( 231 map->GetContentSetting(
224 url, url, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, std::string())); 232 url, url, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, std::string()));
225 EXPECT_EQ(CONTENT_SETTING_ASK, 233 EXPECT_EQ(CONTENT_SETTING_ASK,
226 map->GetContentSetting( 234 map->GetContentSetting(
227 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string())); 235 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string()));
228 EXPECT_EQ(CONTENT_SETTING_ASK, 236 EXPECT_EQ(CONTENT_SETTING_ASK,
229 map->GetContentSetting( 237 map->GetContentSetting(
230 url, url, CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, 238 url, url, CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS,
231 std::string())); 239 std::string()));
240 EXPECT_EQ(CONTENT_SETTING_ALLOW,
241 map->GetContentSetting(
242 url, url, CONTENT_SETTINGS_TYPE_AUTOPLAY, std::string()));
232 } 243 }
233 244
234 private: 245 private:
235 Profile* profile_; 246 Profile* profile_;
236 std::unique_ptr<ScopedKeepAlive> keep_alive_; 247 std::unique_ptr<ScopedKeepAlive> keep_alive_;
237 }; 248 };
238 249
239 // http://crbug.com/177163 250 // http://crbug.com/177163
240 #if defined(OS_WIN) && !defined(NDEBUG) 251 #if defined(OS_WIN) && !defined(NDEBUG)
241 #define MAYBE_Standard DISABLED_Standard 252 #define MAYBE_Standard DISABLED_Standard
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 << message_; 304 << message_;
294 } 305 }
295 306
296 IN_PROC_BROWSER_TEST_F(ExtensionContentSettingsApiTest, 307 IN_PROC_BROWSER_TEST_F(ExtensionContentSettingsApiTest,
297 UnsupportedDefaultSettings) { 308 UnsupportedDefaultSettings) {
298 const char kExtensionPath[] = "content_settings/unsupporteddefaultsettings"; 309 const char kExtensionPath[] = "content_settings/unsupporteddefaultsettings";
299 EXPECT_TRUE(RunExtensionSubtest(kExtensionPath, "test.html")) << message_; 310 EXPECT_TRUE(RunExtensionSubtest(kExtensionPath, "test.html")) << message_;
300 } 311 }
301 312
302 } // namespace extensions 313 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698