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

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

Issue 889893002: Expose camera settings to the extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, 114 EXPECT_EQ(CONTENT_SETTING_ASK,
115 map->GetContentSetting(example_url, 115 map->GetContentSetting(example_url,
116 example_url, 116 example_url,
117 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, 117 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
118 std::string())); 118 std::string()));
119 EXPECT_EQ(CONTENT_SETTING_ASK,
120 map->GetContentSetting(example_url,
121 example_url,
122 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA,
123 std::string()));
119 124
120 // Check content settings for www.google.com 125 // Check content settings for www.google.com
121 GURL url("http://www.google.com"); 126 GURL url("http://www.google.com");
122 EXPECT_FALSE(cookie_settings->IsReadingCookieAllowed(url, url)); 127 EXPECT_FALSE(cookie_settings->IsReadingCookieAllowed(url, url));
123 EXPECT_EQ(CONTENT_SETTING_ALLOW, 128 EXPECT_EQ(CONTENT_SETTING_ALLOW,
124 map->GetContentSetting( 129 map->GetContentSetting(
125 url, url, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); 130 url, url, CONTENT_SETTINGS_TYPE_IMAGES, std::string()));
126 EXPECT_EQ(CONTENT_SETTING_BLOCK, 131 EXPECT_EQ(CONTENT_SETTING_BLOCK,
127 map->GetContentSetting( 132 map->GetContentSetting(
128 url, url, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string())); 133 url, url, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string()));
129 EXPECT_EQ(CONTENT_SETTING_BLOCK, 134 EXPECT_EQ(CONTENT_SETTING_BLOCK,
130 map->GetContentSetting( 135 map->GetContentSetting(
131 url, url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string())); 136 url, url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string()));
132 EXPECT_EQ(CONTENT_SETTING_ALLOW, 137 EXPECT_EQ(CONTENT_SETTING_ALLOW,
133 map->GetContentSetting( 138 map->GetContentSetting(
134 url, url, CONTENT_SETTINGS_TYPE_POPUPS, std::string())); 139 url, url, CONTENT_SETTINGS_TYPE_POPUPS, std::string()));
135 EXPECT_EQ(CONTENT_SETTING_BLOCK, 140 EXPECT_EQ(CONTENT_SETTING_BLOCK,
136 map->GetContentSetting( 141 map->GetContentSetting(
137 url, url, CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string())); 142 url, url, CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string()));
138 EXPECT_EQ( 143 EXPECT_EQ(
139 CONTENT_SETTING_BLOCK, 144 CONTENT_SETTING_BLOCK,
140 map->GetContentSetting( 145 map->GetContentSetting(
141 url, url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string())); 146 url, url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string()));
142 EXPECT_EQ(CONTENT_SETTING_BLOCK, 147 EXPECT_EQ(CONTENT_SETTING_BLOCK,
143 map->GetContentSetting( 148 map->GetContentSetting(
144 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string())); 149 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()));
145 EXPECT_EQ(CONTENT_SETTING_BLOCK, 150 EXPECT_EQ(CONTENT_SETTING_BLOCK,
146 map->GetContentSetting( 151 map->GetContentSetting(
147 url, url, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, std::string())); 152 url, url, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, std::string()));
153 EXPECT_EQ(CONTENT_SETTING_BLOCK,
154 map->GetContentSetting(
155 url, url, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, std::string()));
148 } 156 }
149 157
150 void CheckContentSettingsDefault() { 158 void CheckContentSettingsDefault() {
151 HostContentSettingsMap* map = 159 HostContentSettingsMap* map =
152 profile_->GetHostContentSettingsMap(); 160 profile_->GetHostContentSettingsMap();
153 CookieSettings* cookie_settings = 161 CookieSettings* cookie_settings =
154 CookieSettings::Factory::GetForProfile(profile_).get(); 162 CookieSettings::Factory::GetForProfile(profile_).get();
155 163
156 // Check content settings for www.google.com 164 // Check content settings for www.google.com
157 GURL url("http://www.google.com"); 165 GURL url("http://www.google.com");
(...skipping 18 matching lines...) Expand all
176 EXPECT_EQ( 184 EXPECT_EQ(
177 CONTENT_SETTING_ASK, 185 CONTENT_SETTING_ASK,
178 map->GetContentSetting( 186 map->GetContentSetting(
179 url, url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string())); 187 url, url, CONTENT_SETTINGS_TYPE_NOTIFICATIONS, std::string()));
180 EXPECT_EQ(CONTENT_SETTING_ASK, 188 EXPECT_EQ(CONTENT_SETTING_ASK,
181 map->GetContentSetting( 189 map->GetContentSetting(
182 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string())); 190 url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()));
183 EXPECT_EQ(CONTENT_SETTING_ASK, 191 EXPECT_EQ(CONTENT_SETTING_ASK,
184 map->GetContentSetting( 192 map->GetContentSetting(
185 url, url, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, std::string())); 193 url, url, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, std::string()));
194 EXPECT_EQ(CONTENT_SETTING_ASK,
195 map->GetContentSetting(
196 url, url, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, std::string()));
186 } 197 }
187 198
188 private: 199 private:
189 Profile* profile_; 200 Profile* profile_;
190 }; 201 };
191 202
192 // http://crbug.com/177163 203 // http://crbug.com/177163
193 #if defined(OS_WIN) && !defined(NDEBUG) 204 #if defined(OS_WIN) && !defined(NDEBUG)
194 #define MAYBE_Standard DISABLED_Standard 205 #define MAYBE_Standard DISABLED_Standard
195 #else 206 #else
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 base::FilePath(kBarPath), 251 base::FilePath(kBarPath),
241 base::ASCIIToUTF16("2.3.4"), 252 base::ASCIIToUTF16("2.3.4"),
242 base::ASCIIToUTF16("bar")), 253 base::ASCIIToUTF16("bar")),
243 false); 254 false);
244 255
245 EXPECT_TRUE(RunExtensionTest("content_settings/getresourceidentifiers")) 256 EXPECT_TRUE(RunExtensionTest("content_settings/getresourceidentifiers"))
246 << message_; 257 << message_;
247 } 258 }
248 259
249 } // namespace extensions 260 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698