Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / ui / content_settings / content_setting_bubble_model_unittest.cc
blob5f960b48060a62f5d235ce1c6a7824876883fc70
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
3 // found in the LICENSE file.
5 #include "base/auto_reset.h"
6 #include "base/command_line.h"
7 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
10 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
11 #include "chrome/browser/infobars/infobar_service.h"
12 #include "chrome/browser/media/media_capture_devices_dispatcher.h"
13 #include "chrome/browser/media/media_stream_capture_indicator.h"
14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
16 #include "chrome/common/chrome_switches.h"
17 #include "chrome/common/pref_names.h"
18 #include "chrome/grit/generated_resources.h"
19 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
20 #include "chrome/test/base/testing_profile.h"
21 #include "components/content_settings/core/browser/host_content_settings_map.h"
22 #include "components/content_settings/core/common/content_settings.h"
23 #include "components/infobars/core/infobar_delegate.h"
24 #include "components/url_formatter/elide_url.h"
25 #include "content/public/browser/web_contents.h"
26 #include "content/public/test/web_contents_tester.h"
27 #include "testing/gtest/include/gtest/gtest.h"
28 #include "ui/base/l10n/l10n_util.h"
30 using content::WebContentsTester;
32 class ContentSettingBubbleModelTest : public ChromeRenderViewHostTestHarness {
33 protected:
34 void SetUp() override {
35 ChromeRenderViewHostTestHarness::SetUp();
36 TabSpecificContentSettings::CreateForWebContents(web_contents());
37 InfoBarService::CreateForWebContents(web_contents());
40 void CheckGeolocationBubble(size_t expected_domains,
41 bool expect_clear_link,
42 bool expect_reload_hint) {
43 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
44 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
45 NULL, web_contents(), profile(),
46 CONTENT_SETTINGS_TYPE_GEOLOCATION));
47 const ContentSettingBubbleModel::BubbleContent& bubble_content =
48 content_setting_bubble_model->bubble_content();
49 EXPECT_TRUE(bubble_content.title.empty());
50 EXPECT_TRUE(bubble_content.radio_group.radio_items.empty());
51 EXPECT_TRUE(bubble_content.list_items.empty());
52 EXPECT_EQ(expected_domains, bubble_content.domain_lists.size());
53 EXPECT_NE(expect_clear_link || expect_reload_hint,
54 bubble_content.custom_link.empty());
55 EXPECT_EQ(expect_clear_link, bubble_content.custom_link_enabled);
56 EXPECT_FALSE(bubble_content.manage_link.empty());
59 std::string GetDefaultAudioDevice() {
60 PrefService* prefs = profile()->GetPrefs();
61 return prefs->GetString(prefs::kDefaultAudioCaptureDevice);
64 std::string GetDefaultVideoDevice() {
65 PrefService* prefs = profile()->GetPrefs();
66 return prefs->GetString(prefs::kDefaultVideoCaptureDevice);
70 TEST_F(ContentSettingBubbleModelTest, ImageRadios) {
71 TabSpecificContentSettings* content_settings =
72 TabSpecificContentSettings::FromWebContents(web_contents());
73 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES);
75 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
76 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
77 NULL, web_contents(), profile(),
78 CONTENT_SETTINGS_TYPE_IMAGES));
79 const ContentSettingBubbleModel::BubbleContent& bubble_content =
80 content_setting_bubble_model->bubble_content();
81 EXPECT_FALSE(bubble_content.title.empty());
82 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size());
83 EXPECT_EQ(0, bubble_content.radio_group.default_item);
84 EXPECT_TRUE(bubble_content.custom_link.empty());
85 EXPECT_FALSE(bubble_content.manage_link.empty());
88 TEST_F(ContentSettingBubbleModelTest, Cookies) {
89 TabSpecificContentSettings* content_settings =
90 TabSpecificContentSettings::FromWebContents(web_contents());
91 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES);
93 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
94 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
95 NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_COOKIES));
96 const ContentSettingBubbleModel::BubbleContent& bubble_content =
97 content_setting_bubble_model->bubble_content();
98 std::string title = bubble_content.title;
99 EXPECT_FALSE(title.empty());
100 ASSERT_EQ(2U, bubble_content.radio_group.radio_items.size());
101 EXPECT_FALSE(bubble_content.custom_link.empty());
102 EXPECT_TRUE(bubble_content.custom_link_enabled);
103 EXPECT_FALSE(bubble_content.manage_link.empty());
105 content_settings->ClearCookieSpecificContentSettings();
106 content_settings->OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES);
107 content_setting_bubble_model.reset(
108 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
109 NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_COOKIES));
110 const ContentSettingBubbleModel::BubbleContent& bubble_content_2 =
111 content_setting_bubble_model->bubble_content();
113 EXPECT_FALSE(bubble_content_2.title.empty());
114 EXPECT_NE(title, bubble_content_2.title);
115 ASSERT_EQ(2U, bubble_content_2.radio_group.radio_items.size());
116 EXPECT_EQ(bubble_content_2.radio_group.radio_items[0],
117 l10n_util::GetStringUTF8(IDS_ALLOWED_COOKIES_NO_ACTION));
118 EXPECT_EQ(bubble_content_2.radio_group.radio_items[1],
119 l10n_util::GetStringFUTF8(
120 IDS_ALLOWED_COOKIES_BLOCK,
121 url_formatter::FormatUrlForSecurityDisplay(
122 web_contents()->GetURL(), profile()->GetPrefs()->GetString(
123 prefs::kAcceptLanguages))));
124 EXPECT_FALSE(bubble_content_2.custom_link.empty());
125 EXPECT_TRUE(bubble_content_2.custom_link_enabled);
126 EXPECT_FALSE(bubble_content_2.manage_link.empty());
129 TEST_F(ContentSettingBubbleModelTest, MediastreamMicAndCamera) {
130 // Required to break dependency on BrowserMainLoop.
131 MediaCaptureDevicesDispatcher::GetInstance()->
132 DisableDeviceEnumerationForTesting();
134 TabSpecificContentSettings* content_settings =
135 TabSpecificContentSettings::FromWebContents(web_contents());
136 std::string request_host = "google.com";
137 GURL security_origin("http://" + request_host);
138 TabSpecificContentSettings::MicrophoneCameraState microphone_camera_state =
139 TabSpecificContentSettings::MICROPHONE_ACCESSED |
140 TabSpecificContentSettings::CAMERA_ACCESSED;
141 content_settings->OnMediaStreamPermissionSet(security_origin,
142 microphone_camera_state,
143 GetDefaultAudioDevice(),
144 GetDefaultVideoDevice(),
145 std::string(),
146 std::string());
148 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
149 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
150 NULL, web_contents(), profile(),
151 CONTENT_SETTINGS_TYPE_MEDIASTREAM));
152 const ContentSettingBubbleModel::BubbleContent& bubble_content =
153 content_setting_bubble_model->bubble_content();
154 EXPECT_EQ(bubble_content.title,
155 l10n_util::GetStringUTF8(IDS_MICROPHONE_CAMERA_ALLOWED));
156 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size());
157 EXPECT_EQ(bubble_content.radio_group.radio_items[0],
158 l10n_util::GetStringFUTF8(
159 IDS_ALLOWED_MEDIASTREAM_MIC_AND_CAMERA_NO_ACTION,
160 url_formatter::FormatUrlForSecurityDisplay(
161 security_origin, profile()->GetPrefs()->GetString(
162 prefs::kAcceptLanguages))));
163 EXPECT_EQ(bubble_content.radio_group.radio_items[1],
164 l10n_util::GetStringUTF8(
165 IDS_ALLOWED_MEDIASTREAM_MIC_AND_CAMERA_BLOCK));
166 EXPECT_EQ(0, bubble_content.radio_group.default_item);
167 EXPECT_TRUE(bubble_content.custom_link.empty());
168 EXPECT_FALSE(bubble_content.custom_link_enabled);
169 EXPECT_FALSE(bubble_content.manage_link.empty());
170 EXPECT_EQ(2U, bubble_content.media_menus.size());
173 TEST_F(ContentSettingBubbleModelTest, BlockedMediastreamMicAndCamera) {
174 // Required to break dependency on BrowserMainLoop.
175 MediaCaptureDevicesDispatcher::GetInstance()->
176 DisableDeviceEnumerationForTesting();
178 WebContentsTester::For(web_contents())->
179 NavigateAndCommit(GURL("https://www.example.com"));
180 GURL url = web_contents()->GetURL();
182 HostContentSettingsMap* host_content_settings_map =
183 profile()->GetHostContentSettingsMap();
184 ContentSettingsPattern primary_pattern =
185 ContentSettingsPattern::FromURL(url);
186 ContentSetting setting = CONTENT_SETTING_BLOCK;
187 host_content_settings_map->SetContentSetting(
188 primary_pattern,
189 ContentSettingsPattern::Wildcard(),
190 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
191 std::string(),
192 setting);
193 host_content_settings_map->SetContentSetting(
194 primary_pattern,
195 ContentSettingsPattern::Wildcard(),
196 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA,
197 std::string(),
198 setting);
200 TabSpecificContentSettings* content_settings =
201 TabSpecificContentSettings::FromWebContents(web_contents());
202 TabSpecificContentSettings::MicrophoneCameraState microphone_camera_state =
203 TabSpecificContentSettings::MICROPHONE_ACCESSED |
204 TabSpecificContentSettings::MICROPHONE_BLOCKED |
205 TabSpecificContentSettings::CAMERA_ACCESSED |
206 TabSpecificContentSettings::CAMERA_BLOCKED;
207 content_settings->OnMediaStreamPermissionSet(url,
208 microphone_camera_state,
209 GetDefaultAudioDevice(),
210 GetDefaultVideoDevice(),
211 std::string(),
212 std::string());
214 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
215 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
216 NULL, web_contents(), profile(),
217 CONTENT_SETTINGS_TYPE_MEDIASTREAM));
218 const ContentSettingBubbleModel::BubbleContent& bubble_content =
219 content_setting_bubble_model->bubble_content();
220 // Test if the correct radio item is selected for the blocked mediastream
221 // setting.
222 EXPECT_EQ(1, bubble_content.radio_group.default_item);
225 // Test that the media settings where not changed.
226 EXPECT_EQ(CONTENT_SETTING_BLOCK,
227 host_content_settings_map->GetContentSetting(
228 url,
229 url,
230 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
231 std::string()));
232 EXPECT_EQ(CONTENT_SETTING_BLOCK,
233 host_content_settings_map->GetContentSetting(
234 url,
235 url,
236 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA,
237 std::string()));
240 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
241 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
242 NULL, web_contents(), profile(),
243 CONTENT_SETTINGS_TYPE_MEDIASTREAM));
244 // Change the radio setting.
245 content_setting_bubble_model->OnRadioClicked(0);
247 // Test that the media setting were change correctly.
248 EXPECT_EQ(CONTENT_SETTING_ALLOW,
249 host_content_settings_map->GetContentSetting(
250 url,
251 url,
252 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
253 std::string()));
254 EXPECT_EQ(CONTENT_SETTING_ALLOW,
255 host_content_settings_map->GetContentSetting(
256 url,
257 url,
258 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA,
259 std::string()));
262 // Tests whether a changed setting in the setting bubble is displayed again when
263 // the bubble is re-opened.
264 TEST_F(ContentSettingBubbleModelTest, MediastreamContentBubble) {
265 // Required to break dependency on BrowserMainLoop.
266 MediaCaptureDevicesDispatcher::GetInstance()->
267 DisableDeviceEnumerationForTesting();
269 WebContentsTester::For(web_contents())->
270 NavigateAndCommit(GURL("https://www.example.com"));
271 GURL url = web_contents()->GetURL();
273 HostContentSettingsMap* host_content_settings_map =
274 profile()->GetHostContentSettingsMap();
275 ContentSettingsPattern primary_pattern =
276 ContentSettingsPattern::FromURL(url);
277 ContentSetting setting = CONTENT_SETTING_BLOCK;
278 host_content_settings_map->SetContentSetting(
279 primary_pattern,
280 ContentSettingsPattern::Wildcard(),
281 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
282 std::string(),
283 setting);
285 TabSpecificContentSettings* content_settings =
286 TabSpecificContentSettings::FromWebContents(web_contents());
287 TabSpecificContentSettings::MicrophoneCameraState microphone_camera_state =
288 TabSpecificContentSettings::MICROPHONE_ACCESSED |
289 TabSpecificContentSettings::MICROPHONE_BLOCKED;
290 content_settings->OnMediaStreamPermissionSet(url,
291 microphone_camera_state,
292 GetDefaultAudioDevice(),
293 std::string(),
294 std::string(),
295 std::string());
297 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
298 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
299 NULL, web_contents(), profile(),
300 CONTENT_SETTINGS_TYPE_MEDIASTREAM));
301 const ContentSettingBubbleModel::BubbleContent& bubble_content =
302 content_setting_bubble_model->bubble_content();
303 // Test if the correct radio item is selected for the blocked mediastream
304 // setting.
305 EXPECT_EQ(1, bubble_content.radio_group.default_item);
306 // Change the radio setting.
307 content_setting_bubble_model->OnRadioClicked(0);
309 // Test that the setting was changed.
310 EXPECT_EQ(CONTENT_SETTING_ALLOW,
311 host_content_settings_map->GetContentSetting(
312 url,
313 url,
314 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
315 std::string()));
318 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
319 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
320 NULL, web_contents(), profile(),
321 CONTENT_SETTINGS_TYPE_MEDIASTREAM));
322 const ContentSettingBubbleModel::BubbleContent& bubble_content =
323 content_setting_bubble_model->bubble_content();
324 // Test that the reload hint is displayed.
325 EXPECT_FALSE(bubble_content.custom_link_enabled);
326 EXPECT_EQ(bubble_content.custom_link, l10n_util::GetStringUTF8(
327 IDS_MEDIASTREAM_SETTING_CHANGED_MESSAGE));
329 EXPECT_EQ(0, bubble_content.radio_group.default_item);
330 // Restore the radio setting (to block).
331 content_setting_bubble_model->OnRadioClicked(1);
333 // Test that the media settings were changed again.
334 EXPECT_EQ(CONTENT_SETTING_BLOCK,
335 host_content_settings_map->GetContentSetting(
336 url,
337 url,
338 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
339 std::string()));
342 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
343 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
344 NULL, web_contents(), profile(),
345 CONTENT_SETTINGS_TYPE_MEDIASTREAM));
346 const ContentSettingBubbleModel::BubbleContent& bubble_content =
347 content_setting_bubble_model->bubble_content();
348 // Test that the reload hint is not displayed any more.
349 EXPECT_FALSE(bubble_content.custom_link_enabled);
350 EXPECT_TRUE(bubble_content.custom_link.empty());
352 EXPECT_EQ(1, bubble_content.radio_group.default_item);
356 // Tests whether the media menu settings are correctly persisted in the bubble.
357 TEST_F(ContentSettingBubbleModelTest, MediastreamContentBubbleMediaMenus) {
358 // Required to break dependency on BrowserMainLoop.
359 MediaCaptureDevicesDispatcher::GetInstance()->
360 DisableDeviceEnumerationForTesting();
362 WebContentsTester::For(web_contents())->
363 NavigateAndCommit(GURL("https://www.example.com"));
364 GURL url = web_contents()->GetURL();
366 content::MediaStreamDevices audio_devices;
367 content::MediaStreamDevice fake_audio_device1(
368 content::MEDIA_DEVICE_AUDIO_CAPTURE, "fake_dev1", "Fake Audio Device 1");
369 content::MediaStreamDevice fake_audio_device2(
370 content::MEDIA_DEVICE_AUDIO_CAPTURE, "fake_dev2", "Fake Audio Device 2");
371 content::MediaStreamDevice fake_audio_device3(
372 content::MEDIA_DEVICE_AUDIO_CAPTURE, "fake_dev3", "Fake Audio Device 3");
373 audio_devices.push_back(fake_audio_device1);
374 audio_devices.push_back(fake_audio_device2);
375 audio_devices.push_back(fake_audio_device3);
376 MediaCaptureDevicesDispatcher::GetInstance()->SetTestAudioCaptureDevices(
377 audio_devices);
379 TabSpecificContentSettings* content_settings =
380 TabSpecificContentSettings::FromWebContents(web_contents());
381 TabSpecificContentSettings::MicrophoneCameraState microphone_camera_state =
382 TabSpecificContentSettings::MICROPHONE_ACCESSED |
383 TabSpecificContentSettings::MICROPHONE_BLOCKED;
384 content_settings->OnMediaStreamPermissionSet(url,
385 microphone_camera_state,
386 GetDefaultAudioDevice(),
387 std::string(),
388 std::string(),
389 std::string());
391 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
392 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
393 NULL, web_contents(), profile(),
394 CONTENT_SETTINGS_TYPE_MEDIASTREAM));
395 const ContentSettingBubbleModel::BubbleContent& bubble_content =
396 content_setting_bubble_model->bubble_content();
397 EXPECT_TRUE(bubble_content.custom_link.empty());
399 EXPECT_EQ(1U, bubble_content.media_menus.size());
400 EXPECT_EQ(content::MEDIA_DEVICE_AUDIO_CAPTURE,
401 bubble_content.media_menus.begin()->first);
402 EXPECT_FALSE(bubble_content.media_menus.begin()->second.disabled);
403 // The first audio device should be selected by default.
404 EXPECT_TRUE(fake_audio_device1.IsEqual(
405 bubble_content.media_menus.begin()->second.selected_device));
407 // Select a different (the second) device.
408 content_setting_bubble_model->OnMediaMenuClicked(
409 content::MEDIA_DEVICE_AUDIO_CAPTURE,
410 fake_audio_device2.id);
413 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
414 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
415 NULL, web_contents(), profile(),
416 CONTENT_SETTINGS_TYPE_MEDIASTREAM));
417 const ContentSettingBubbleModel::BubbleContent& bubble_content =
418 content_setting_bubble_model->bubble_content();
419 EXPECT_EQ(1U, bubble_content.media_menus.size());
420 EXPECT_EQ(content::MEDIA_DEVICE_AUDIO_CAPTURE,
421 bubble_content.media_menus.begin()->first);
422 EXPECT_FALSE(bubble_content.media_menus.begin()->second.disabled);
423 // The second audio device should be selected.
424 EXPECT_TRUE(fake_audio_device2.IsEqual(
425 bubble_content.media_menus.begin()->second.selected_device));
426 // The "settings changed" message should not be displayed when there is no
427 // active capture.
428 EXPECT_FALSE(bubble_content.custom_link_enabled);
429 EXPECT_TRUE(bubble_content.custom_link.empty());
432 // Simulate that an audio stream is being captured.
433 scoped_refptr<MediaStreamCaptureIndicator> indicator =
434 MediaCaptureDevicesDispatcher::GetInstance()->
435 GetMediaStreamCaptureIndicator();
436 scoped_ptr<content::MediaStreamUI> media_stream_ui =
437 indicator->RegisterMediaStream(web_contents(), audio_devices);
438 media_stream_ui->OnStarted(base::Closure());
439 microphone_camera_state &= ~TabSpecificContentSettings::MICROPHONE_BLOCKED;
440 content_settings->OnMediaStreamPermissionSet(url,
441 microphone_camera_state,
442 GetDefaultAudioDevice(),
443 std::string(),
444 std::string(),
445 std::string());
448 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
449 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
450 NULL, web_contents(), profile(),
451 CONTENT_SETTINGS_TYPE_MEDIASTREAM));
452 const ContentSettingBubbleModel::BubbleContent& bubble_content =
453 content_setting_bubble_model->bubble_content();
454 // Settings not changed yet, so the "settings changed" message should not be
455 // shown.
456 EXPECT_TRUE(bubble_content.custom_link.empty());
458 EXPECT_EQ(1U, bubble_content.media_menus.size());
459 EXPECT_EQ(content::MEDIA_DEVICE_AUDIO_CAPTURE,
460 bubble_content.media_menus.begin()->first);
461 EXPECT_FALSE(bubble_content.media_menus.begin()->second.disabled);
462 EXPECT_TRUE(fake_audio_device2.IsEqual(
463 bubble_content.media_menus.begin()->second.selected_device));
465 // Select a different different device.
466 content_setting_bubble_model->OnMediaMenuClicked(
467 content::MEDIA_DEVICE_AUDIO_CAPTURE,
468 fake_audio_device3.id);
472 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
473 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
474 NULL, web_contents(), profile(),
475 CONTENT_SETTINGS_TYPE_MEDIASTREAM));
476 const ContentSettingBubbleModel::BubbleContent& bubble_content =
477 content_setting_bubble_model->bubble_content();
478 // Test that the reload hint is displayed.
479 EXPECT_FALSE(bubble_content.custom_link_enabled);
480 EXPECT_EQ(bubble_content.custom_link, l10n_util::GetStringUTF8(
481 IDS_MEDIASTREAM_SETTING_CHANGED_MESSAGE));
484 // Simulate that yet another audio stream capture request was initiated.
485 microphone_camera_state |= TabSpecificContentSettings::MICROPHONE_BLOCKED;
486 content_settings->OnMediaStreamPermissionSet(url,
487 microphone_camera_state,
488 GetDefaultAudioDevice(),
489 std::string(),
490 std::string(),
491 std::string());
494 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
495 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
496 NULL, web_contents(), profile(),
497 CONTENT_SETTINGS_TYPE_MEDIASTREAM));
498 const ContentSettingBubbleModel::BubbleContent& bubble_content =
499 content_setting_bubble_model->bubble_content();
500 // Test that the reload hint is not displayed any more, because this is a
501 // new permission request.
502 EXPECT_FALSE(bubble_content.custom_link_enabled);
503 EXPECT_TRUE(bubble_content.custom_link.empty());
505 // Though the audio menu setting should have persisted.
506 EXPECT_EQ(1U, bubble_content.media_menus.size());
507 EXPECT_EQ(content::MEDIA_DEVICE_AUDIO_CAPTURE,
508 bubble_content.media_menus.begin()->first);
509 EXPECT_FALSE(bubble_content.media_menus.begin()->second.disabled);
510 EXPECT_TRUE(fake_audio_device3.IsEqual(
511 bubble_content.media_menus.begin()->second.selected_device));
515 TEST_F(ContentSettingBubbleModelTest, MediastreamMic) {
516 // Required to break dependency on BrowserMainLoop.
517 MediaCaptureDevicesDispatcher::GetInstance()->
518 DisableDeviceEnumerationForTesting();
520 TabSpecificContentSettings* content_settings =
521 TabSpecificContentSettings::FromWebContents(web_contents());
522 std::string request_host = "google.com";
523 GURL security_origin("http://" + request_host);
524 TabSpecificContentSettings::MicrophoneCameraState microphone_camera_state =
525 TabSpecificContentSettings::MICROPHONE_ACCESSED;
526 content_settings->OnMediaStreamPermissionSet(security_origin,
527 microphone_camera_state,
528 GetDefaultAudioDevice(),
529 std::string(),
530 std::string(),
531 std::string());
533 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
534 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
535 NULL, web_contents(), profile(),
536 CONTENT_SETTINGS_TYPE_MEDIASTREAM));
537 const ContentSettingBubbleModel::BubbleContent& bubble_content =
538 content_setting_bubble_model->bubble_content();
539 EXPECT_EQ(bubble_content.title,
540 l10n_util::GetStringUTF8(IDS_MICROPHONE_ACCESSED));
541 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size());
542 EXPECT_EQ(bubble_content.radio_group.radio_items[0],
543 l10n_util::GetStringFUTF8(
544 IDS_ALLOWED_MEDIASTREAM_MIC_NO_ACTION,
545 url_formatter::FormatUrlForSecurityDisplay(
546 security_origin, profile()->GetPrefs()->GetString(
547 prefs::kAcceptLanguages))));
548 EXPECT_EQ(bubble_content.radio_group.radio_items[1],
549 l10n_util::GetStringUTF8(
550 IDS_ALLOWED_MEDIASTREAM_MIC_BLOCK));
551 EXPECT_EQ(0, bubble_content.radio_group.default_item);
552 EXPECT_TRUE(bubble_content.custom_link.empty());
553 EXPECT_FALSE(bubble_content.custom_link_enabled);
554 EXPECT_FALSE(bubble_content.manage_link.empty());
555 EXPECT_EQ(1U, bubble_content.media_menus.size());
556 EXPECT_EQ(content::MEDIA_DEVICE_AUDIO_CAPTURE,
557 bubble_content.media_menus.begin()->first);
559 // Change the microphone access.
560 microphone_camera_state |= TabSpecificContentSettings::MICROPHONE_BLOCKED;
561 content_settings->OnMediaStreamPermissionSet(security_origin,
562 microphone_camera_state,
563 GetDefaultAudioDevice(),
564 std::string(),
565 std::string(),
566 std::string());
567 content_setting_bubble_model.reset(
568 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
569 NULL, web_contents(), profile(),
570 CONTENT_SETTINGS_TYPE_MEDIASTREAM));
571 const ContentSettingBubbleModel::BubbleContent& new_bubble_content =
572 content_setting_bubble_model->bubble_content();
573 EXPECT_EQ(new_bubble_content.title,
574 l10n_util::GetStringUTF8(IDS_MICROPHONE_BLOCKED));
575 EXPECT_EQ(2U, new_bubble_content.radio_group.radio_items.size());
576 EXPECT_EQ(new_bubble_content.radio_group.radio_items[0],
577 l10n_util::GetStringFUTF8(
578 IDS_BLOCKED_MEDIASTREAM_MIC_ASK,
579 url_formatter::FormatUrlForSecurityDisplay(
580 security_origin, profile()->GetPrefs()->GetString(
581 prefs::kAcceptLanguages))));
582 EXPECT_EQ(new_bubble_content.radio_group.radio_items[1],
583 l10n_util::GetStringUTF8(
584 IDS_BLOCKED_MEDIASTREAM_MIC_NO_ACTION));
585 EXPECT_EQ(1, new_bubble_content.radio_group.default_item);
586 EXPECT_TRUE(new_bubble_content.custom_link.empty());
587 EXPECT_FALSE(new_bubble_content.custom_link_enabled);
588 EXPECT_FALSE(new_bubble_content.manage_link.empty());
589 EXPECT_EQ(1U, new_bubble_content.media_menus.size());
590 EXPECT_EQ(content::MEDIA_DEVICE_AUDIO_CAPTURE,
591 new_bubble_content.media_menus.begin()->first);
594 TEST_F(ContentSettingBubbleModelTest, MediastreamCamera) {
595 // Required to break dependency on BrowserMainLoop.
596 MediaCaptureDevicesDispatcher::GetInstance()->
597 DisableDeviceEnumerationForTesting();
599 TabSpecificContentSettings* content_settings =
600 TabSpecificContentSettings::FromWebContents(web_contents());
601 std::string request_host = "google.com";
602 GURL security_origin("http://" + request_host);
603 TabSpecificContentSettings::MicrophoneCameraState microphone_camera_state =
604 TabSpecificContentSettings::CAMERA_ACCESSED;
605 content_settings->OnMediaStreamPermissionSet(security_origin,
606 microphone_camera_state,
607 std::string(),
608 GetDefaultVideoDevice(),
609 std::string(),
610 std::string());
612 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
613 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
614 NULL, web_contents(), profile(),
615 CONTENT_SETTINGS_TYPE_MEDIASTREAM));
616 const ContentSettingBubbleModel::BubbleContent& bubble_content =
617 content_setting_bubble_model->bubble_content();
618 EXPECT_EQ(bubble_content.title,
619 l10n_util::GetStringUTF8(IDS_CAMERA_ACCESSED));
620 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size());
621 EXPECT_EQ(bubble_content.radio_group.radio_items[0],
622 l10n_util::GetStringFUTF8(
623 IDS_ALLOWED_MEDIASTREAM_CAMERA_NO_ACTION,
624 url_formatter::FormatUrlForSecurityDisplay(
625 security_origin, profile()->GetPrefs()->GetString(
626 prefs::kAcceptLanguages))));
627 EXPECT_EQ(bubble_content.radio_group.radio_items[1],
628 l10n_util::GetStringUTF8(
629 IDS_ALLOWED_MEDIASTREAM_CAMERA_BLOCK));
630 EXPECT_EQ(0, bubble_content.radio_group.default_item);
631 EXPECT_TRUE(bubble_content.custom_link.empty());
632 EXPECT_FALSE(bubble_content.custom_link_enabled);
633 EXPECT_FALSE(bubble_content.manage_link.empty());
634 EXPECT_EQ(1U, bubble_content.media_menus.size());
635 EXPECT_EQ(content::MEDIA_DEVICE_VIDEO_CAPTURE,
636 bubble_content.media_menus.begin()->first);
638 // Change the camera access.
639 microphone_camera_state |= TabSpecificContentSettings::CAMERA_BLOCKED;
640 content_settings->OnMediaStreamPermissionSet(security_origin,
641 microphone_camera_state,
642 std::string(),
643 GetDefaultVideoDevice(),
644 std::string(),
645 std::string());
646 content_setting_bubble_model.reset(
647 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
648 NULL, web_contents(), profile(),
649 CONTENT_SETTINGS_TYPE_MEDIASTREAM));
650 const ContentSettingBubbleModel::BubbleContent& new_bubble_content =
651 content_setting_bubble_model->bubble_content();
652 EXPECT_EQ(new_bubble_content.title,
653 l10n_util::GetStringUTF8(IDS_CAMERA_BLOCKED));
654 EXPECT_EQ(2U, new_bubble_content.radio_group.radio_items.size());
655 EXPECT_EQ(new_bubble_content.radio_group.radio_items[0],
656 l10n_util::GetStringFUTF8(
657 IDS_BLOCKED_MEDIASTREAM_CAMERA_ASK,
658 url_formatter::FormatUrlForSecurityDisplay(
659 security_origin, profile()->GetPrefs()->GetString(
660 prefs::kAcceptLanguages))));
661 EXPECT_EQ(new_bubble_content.radio_group.radio_items[1],
662 l10n_util::GetStringUTF8(
663 IDS_BLOCKED_MEDIASTREAM_CAMERA_NO_ACTION));
664 EXPECT_EQ(1, new_bubble_content.radio_group.default_item);
665 EXPECT_TRUE(new_bubble_content.custom_link.empty());
666 EXPECT_FALSE(new_bubble_content.custom_link_enabled);
667 EXPECT_FALSE(new_bubble_content.manage_link.empty());
668 EXPECT_EQ(1U, new_bubble_content.media_menus.size());
669 EXPECT_EQ(content::MEDIA_DEVICE_VIDEO_CAPTURE,
670 new_bubble_content.media_menus.begin()->first);
673 TEST_F(ContentSettingBubbleModelTest, AccumulateMediastreamMicAndCamera) {
674 // Required to break dependency on BrowserMainLoop.
675 MediaCaptureDevicesDispatcher::GetInstance()->
676 DisableDeviceEnumerationForTesting();
678 TabSpecificContentSettings* content_settings =
679 TabSpecificContentSettings::FromWebContents(web_contents());
680 std::string request_host = "google.com";
681 GURL security_origin("http://" + request_host);
683 // Firstly, add microphone access.
684 TabSpecificContentSettings::MicrophoneCameraState microphone_camera_state =
685 TabSpecificContentSettings::MICROPHONE_ACCESSED;
686 content_settings->OnMediaStreamPermissionSet(security_origin,
687 microphone_camera_state,
688 GetDefaultAudioDevice(),
689 std::string(),
690 std::string(),
691 std::string());
693 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
694 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
695 NULL, web_contents(), profile(),
696 CONTENT_SETTINGS_TYPE_MEDIASTREAM));
697 const ContentSettingBubbleModel::BubbleContent& bubble_content =
698 content_setting_bubble_model->bubble_content();
699 EXPECT_EQ(bubble_content.title,
700 l10n_util::GetStringUTF8(IDS_MICROPHONE_ACCESSED));
701 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size());
702 EXPECT_EQ(bubble_content.radio_group.radio_items[0],
703 l10n_util::GetStringFUTF8(
704 IDS_ALLOWED_MEDIASTREAM_MIC_NO_ACTION,
705 url_formatter::FormatUrlForSecurityDisplay(
706 security_origin, profile()->GetPrefs()->GetString(
707 prefs::kAcceptLanguages))));
708 EXPECT_EQ(bubble_content.radio_group.radio_items[1],
709 l10n_util::GetStringUTF8(
710 IDS_ALLOWED_MEDIASTREAM_MIC_BLOCK));
711 EXPECT_EQ(0, bubble_content.radio_group.default_item);
712 EXPECT_EQ(1U, bubble_content.media_menus.size());
713 EXPECT_EQ(content::MEDIA_DEVICE_AUDIO_CAPTURE,
714 bubble_content.media_menus.begin()->first);
716 // Then add camera access.
717 microphone_camera_state |= TabSpecificContentSettings::CAMERA_ACCESSED;
718 content_settings->OnMediaStreamPermissionSet(security_origin,
719 microphone_camera_state,
720 GetDefaultAudioDevice(),
721 GetDefaultVideoDevice(),
722 std::string(),
723 std::string());
725 content_setting_bubble_model.reset(
726 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
727 NULL, web_contents(), profile(),
728 CONTENT_SETTINGS_TYPE_MEDIASTREAM));
729 const ContentSettingBubbleModel::BubbleContent& new_bubble_content =
730 content_setting_bubble_model->bubble_content();
731 EXPECT_EQ(new_bubble_content.title,
732 l10n_util::GetStringUTF8(IDS_MICROPHONE_CAMERA_ALLOWED));
733 EXPECT_EQ(2U, new_bubble_content.radio_group.radio_items.size());
734 EXPECT_EQ(new_bubble_content.radio_group.radio_items[0],
735 l10n_util::GetStringFUTF8(
736 IDS_ALLOWED_MEDIASTREAM_MIC_AND_CAMERA_NO_ACTION,
737 url_formatter::FormatUrlForSecurityDisplay(
738 security_origin, profile()->GetPrefs()->GetString(
739 prefs::kAcceptLanguages))));
740 EXPECT_EQ(new_bubble_content.radio_group.radio_items[1],
741 l10n_util::GetStringUTF8(
742 IDS_ALLOWED_MEDIASTREAM_MIC_AND_CAMERA_BLOCK));
743 EXPECT_EQ(0, new_bubble_content.radio_group.default_item);
744 EXPECT_EQ(2U, new_bubble_content.media_menus.size());
747 TEST_F(ContentSettingBubbleModelTest, Plugins) {
748 TabSpecificContentSettings* content_settings =
749 TabSpecificContentSettings::FromWebContents(web_contents());
750 const base::string16 plugin_name = base::ASCIIToUTF16("plugin_name");
752 content_settings->OnContentBlockedWithDetail(CONTENT_SETTINGS_TYPE_PLUGINS,
753 plugin_name);
755 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
756 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
757 NULL, web_contents(), profile(),
758 CONTENT_SETTINGS_TYPE_PLUGINS));
759 const ContentSettingBubbleModel::BubbleContent& bubble_content =
760 content_setting_bubble_model->bubble_content();
761 EXPECT_FALSE(bubble_content.title.empty());
762 ASSERT_EQ(1U, bubble_content.list_items.size());
763 EXPECT_EQ(plugin_name,
764 base::ASCIIToUTF16(bubble_content.list_items[0].title));
765 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size());
766 EXPECT_FALSE(bubble_content.custom_link.empty());
767 EXPECT_TRUE(bubble_content.custom_link_enabled);
768 EXPECT_FALSE(bubble_content.manage_link.empty());
769 EXPECT_FALSE(bubble_content.learn_more_link.empty());
772 TEST_F(ContentSettingBubbleModelTest, PepperBroker) {
773 TabSpecificContentSettings* content_settings =
774 TabSpecificContentSettings::FromWebContents(web_contents());
775 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_PPAPI_BROKER);
777 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
778 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
779 NULL, web_contents(), profile(),
780 CONTENT_SETTINGS_TYPE_PPAPI_BROKER));
781 const ContentSettingBubbleModel::BubbleContent& bubble_content =
782 content_setting_bubble_model->bubble_content();
784 std::string title = bubble_content.title;
785 EXPECT_FALSE(title.empty());
786 ASSERT_EQ(2U, bubble_content.radio_group.radio_items.size());
787 std::string radio1 = bubble_content.radio_group.radio_items[0];
788 std::string radio2 = bubble_content.radio_group.radio_items[1];
789 EXPECT_FALSE(bubble_content.custom_link_enabled);
790 EXPECT_FALSE(bubble_content.manage_link.empty());
792 content_settings->ClearBlockedContentSettingsExceptForCookies();
793 content_settings->OnContentAllowed(CONTENT_SETTINGS_TYPE_PPAPI_BROKER);
794 content_setting_bubble_model.reset(
795 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
796 NULL, web_contents(), profile(),
797 CONTENT_SETTINGS_TYPE_PPAPI_BROKER));
798 const ContentSettingBubbleModel::BubbleContent& bubble_content_2 =
799 content_setting_bubble_model->bubble_content();
801 EXPECT_FALSE(bubble_content_2.title.empty());
802 EXPECT_NE(title, bubble_content_2.title);
803 ASSERT_EQ(2U, bubble_content_2.radio_group.radio_items.size());
804 EXPECT_NE(radio1, bubble_content_2.radio_group.radio_items[0]);
805 EXPECT_NE(radio2, bubble_content_2.radio_group.radio_items[1]);
806 EXPECT_FALSE(bubble_content_2.custom_link_enabled);
807 EXPECT_FALSE(bubble_content_2.manage_link.empty());
810 TEST_F(ContentSettingBubbleModelTest, Geolocation) {
811 const GURL page_url("http://toplevel.example/");
812 const GURL frame1_url("http://host1.example/");
813 const GURL frame2_url("http://host2.example:999/");
815 NavigateAndCommit(page_url);
816 TabSpecificContentSettings* content_settings =
817 TabSpecificContentSettings::FromWebContents(web_contents());
819 // One permitted frame, but not in the content map: requires reload.
820 content_settings->OnGeolocationPermissionSet(frame1_url, true);
821 CheckGeolocationBubble(1, false, true);
823 // Add it to the content map, should now have a clear link.
824 HostContentSettingsMap* setting_map =
825 profile()->GetHostContentSettingsMap();
826 setting_map->SetContentSetting(
827 ContentSettingsPattern::FromURLNoWildcard(frame1_url),
828 ContentSettingsPattern::FromURLNoWildcard(page_url),
829 CONTENT_SETTINGS_TYPE_GEOLOCATION,
830 std::string(),
831 CONTENT_SETTING_ALLOW);
832 CheckGeolocationBubble(1, true, false);
834 // Change the default to allow: no message needed.
835 profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
836 CONTENT_SETTINGS_TYPE_GEOLOCATION, CONTENT_SETTING_ALLOW);
837 CheckGeolocationBubble(1, false, false);
839 // Second frame denied, but not stored in the content map: requires reload.
840 content_settings->OnGeolocationPermissionSet(frame2_url, false);
841 CheckGeolocationBubble(2, false, true);
843 // Change the default to block: offer a clear link for the persisted frame 1.
844 profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
845 CONTENT_SETTINGS_TYPE_GEOLOCATION, CONTENT_SETTING_BLOCK);
846 CheckGeolocationBubble(2, true, false);
849 TEST_F(ContentSettingBubbleModelTest, FileURL) {
850 std::string file_url("file:///tmp/test.html");
851 NavigateAndCommit(GURL(file_url));
852 TabSpecificContentSettings::FromWebContents(web_contents())->OnContentBlocked(
853 CONTENT_SETTINGS_TYPE_IMAGES);
854 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
855 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
856 NULL, web_contents(), profile(),
857 CONTENT_SETTINGS_TYPE_IMAGES));
858 std::string title =
859 content_setting_bubble_model->bubble_content().radio_group.radio_items[0];
860 ASSERT_NE(std::string::npos, title.find(file_url));
863 TEST_F(ContentSettingBubbleModelTest, RegisterProtocolHandler) {
864 const GURL page_url("http://toplevel.example/");
865 NavigateAndCommit(page_url);
866 TabSpecificContentSettings* content_settings =
867 TabSpecificContentSettings::FromWebContents(web_contents());
868 content_settings->set_pending_protocol_handler(
869 ProtocolHandler::CreateProtocolHandler(
870 "mailto", GURL("http://www.toplevel.example/")));
872 ContentSettingRPHBubbleModel content_setting_bubble_model(
873 NULL, web_contents(), profile(), NULL);
875 const ContentSettingBubbleModel::BubbleContent& bubble_content =
876 content_setting_bubble_model.bubble_content();
877 EXPECT_FALSE(bubble_content.title.empty());
878 EXPECT_FALSE(bubble_content.radio_group.radio_items.empty());
879 EXPECT_TRUE(bubble_content.list_items.empty());
880 EXPECT_TRUE(bubble_content.domain_lists.empty());
881 EXPECT_TRUE(bubble_content.custom_link.empty());
882 EXPECT_FALSE(bubble_content.custom_link_enabled);
883 EXPECT_FALSE(bubble_content.manage_link.empty());
886 class FakeDelegate : public ProtocolHandlerRegistry::Delegate {
887 public:
888 void RegisterExternalHandler(const std::string& protocol) override {
889 // Overrides in order to not register the handler with the
890 // ChildProcessSecurityPolicy. That has persistent and unalterable
891 // side effects on other tests.
894 ShellIntegration::DefaultProtocolClientWorker* CreateShellWorker(
895 ShellIntegration::DefaultWebClientObserver* observer,
896 const std::string& protocol) override {
897 VLOG(1) << "CreateShellWorker";
898 return NULL;
901 ProtocolHandlerRegistry::DefaultClientObserver* CreateShellObserver(
902 ProtocolHandlerRegistry* registry) override {
903 return NULL;
906 void RegisterWithOSAsDefaultClient(
907 const std::string& protocol,
908 ProtocolHandlerRegistry* registry) override {
909 VLOG(1) << "Register With OS";
913 TEST_F(ContentSettingBubbleModelTest, RPHAllow) {
914 ProtocolHandlerRegistry registry(profile(), new FakeDelegate());
915 registry.InitProtocolSettings();
917 const GURL page_url("http://toplevel.example/");
918 NavigateAndCommit(page_url);
919 TabSpecificContentSettings* content_settings =
920 TabSpecificContentSettings::FromWebContents(web_contents());
921 ProtocolHandler test_handler = ProtocolHandler::CreateProtocolHandler(
922 "mailto", GURL("http://www.toplevel.example/"));
923 content_settings->set_pending_protocol_handler(test_handler);
925 ContentSettingRPHBubbleModel content_setting_bubble_model(
926 NULL, web_contents(), profile(), &registry);
929 ProtocolHandler handler = registry.GetHandlerFor("mailto");
930 EXPECT_TRUE(handler.IsEmpty());
931 EXPECT_EQ(CONTENT_SETTING_DEFAULT,
932 content_settings->pending_protocol_handler_setting());
935 // "0" is the "Allow" radio button.
936 content_setting_bubble_model.OnRadioClicked(0);
938 ProtocolHandler handler = registry.GetHandlerFor("mailto");
939 ASSERT_FALSE(handler.IsEmpty());
940 EXPECT_EQ(CONTENT_SETTING_ALLOW,
941 content_settings->pending_protocol_handler_setting());
944 // "1" is the "Deny" radio button.
945 content_setting_bubble_model.OnRadioClicked(1);
947 ProtocolHandler handler = registry.GetHandlerFor("mailto");
948 EXPECT_TRUE(handler.IsEmpty());
949 EXPECT_EQ(CONTENT_SETTING_BLOCK,
950 content_settings->pending_protocol_handler_setting());
953 // "2" is the "Ignore button.
954 content_setting_bubble_model.OnRadioClicked(2);
956 ProtocolHandler handler = registry.GetHandlerFor("mailto");
957 EXPECT_TRUE(handler.IsEmpty());
958 EXPECT_EQ(CONTENT_SETTING_DEFAULT,
959 content_settings->pending_protocol_handler_setting());
960 EXPECT_TRUE(registry.IsIgnored(test_handler));
963 // "0" is the "Allow" radio button.
964 content_setting_bubble_model.OnRadioClicked(0);
966 ProtocolHandler handler = registry.GetHandlerFor("mailto");
967 ASSERT_FALSE(handler.IsEmpty());
968 EXPECT_EQ(CONTENT_SETTING_ALLOW,
969 content_settings->pending_protocol_handler_setting());
970 EXPECT_FALSE(registry.IsIgnored(test_handler));
973 registry.Shutdown();