OLD | NEW |
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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 protected: | 36 protected: |
37 void SetUp() override { | 37 void SetUp() override { |
38 ChromeRenderViewHostTestHarness::SetUp(); | 38 ChromeRenderViewHostTestHarness::SetUp(); |
39 TabSpecificContentSettings::CreateForWebContents(web_contents()); | 39 TabSpecificContentSettings::CreateForWebContents(web_contents()); |
40 InfoBarService::CreateForWebContents(web_contents()); | 40 InfoBarService::CreateForWebContents(web_contents()); |
41 } | 41 } |
42 | 42 |
43 void CheckGeolocationBubble(size_t expected_domains, | 43 void CheckGeolocationBubble(size_t expected_domains, |
44 bool expect_clear_link, | 44 bool expect_clear_link, |
45 bool expect_reload_hint) { | 45 bool expect_reload_hint) { |
46 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 46 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
47 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 47 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
48 NULL, web_contents(), profile(), | 48 NULL, web_contents(), profile(), |
49 CONTENT_SETTINGS_TYPE_GEOLOCATION)); | 49 CONTENT_SETTINGS_TYPE_GEOLOCATION)); |
50 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 50 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
51 content_setting_bubble_model->bubble_content(); | 51 content_setting_bubble_model->bubble_content(); |
52 EXPECT_TRUE(bubble_content.title.empty()); | 52 EXPECT_TRUE(bubble_content.title.empty()); |
53 EXPECT_TRUE(bubble_content.radio_group.radio_items.empty()); | 53 EXPECT_TRUE(bubble_content.radio_group.radio_items.empty()); |
54 EXPECT_TRUE(bubble_content.list_items.empty()); | 54 EXPECT_TRUE(bubble_content.list_items.empty()); |
55 EXPECT_EQ(expected_domains, bubble_content.domain_lists.size()); | 55 EXPECT_EQ(expected_domains, bubble_content.domain_lists.size()); |
56 EXPECT_NE(expect_clear_link || expect_reload_hint, | 56 EXPECT_NE(expect_clear_link || expect_reload_hint, |
(...skipping 11 matching lines...) Expand all Loading... |
68 PrefService* prefs = profile()->GetPrefs(); | 68 PrefService* prefs = profile()->GetPrefs(); |
69 return prefs->GetString(prefs::kDefaultVideoCaptureDevice); | 69 return prefs->GetString(prefs::kDefaultVideoCaptureDevice); |
70 } | 70 } |
71 }; | 71 }; |
72 | 72 |
73 TEST_F(ContentSettingBubbleModelTest, ImageRadios) { | 73 TEST_F(ContentSettingBubbleModelTest, ImageRadios) { |
74 TabSpecificContentSettings* content_settings = | 74 TabSpecificContentSettings* content_settings = |
75 TabSpecificContentSettings::FromWebContents(web_contents()); | 75 TabSpecificContentSettings::FromWebContents(web_contents()); |
76 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES); | 76 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES); |
77 | 77 |
78 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 78 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
79 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 79 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
80 NULL, web_contents(), profile(), | 80 NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_IMAGES)); |
81 CONTENT_SETTINGS_TYPE_IMAGES)); | |
82 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 81 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
83 content_setting_bubble_model->bubble_content(); | 82 content_setting_bubble_model->bubble_content(); |
84 EXPECT_FALSE(bubble_content.title.empty()); | 83 EXPECT_FALSE(bubble_content.title.empty()); |
85 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); | 84 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); |
86 EXPECT_EQ(0, bubble_content.radio_group.default_item); | 85 EXPECT_EQ(0, bubble_content.radio_group.default_item); |
87 EXPECT_TRUE(bubble_content.custom_link.empty()); | 86 EXPECT_TRUE(bubble_content.custom_link.empty()); |
88 EXPECT_FALSE(bubble_content.manage_link.empty()); | 87 EXPECT_FALSE(bubble_content.manage_link.empty()); |
89 } | 88 } |
90 | 89 |
91 TEST_F(ContentSettingBubbleModelTest, Cookies) { | 90 TEST_F(ContentSettingBubbleModelTest, Cookies) { |
92 TabSpecificContentSettings* content_settings = | 91 TabSpecificContentSettings* content_settings = |
93 TabSpecificContentSettings::FromWebContents(web_contents()); | 92 TabSpecificContentSettings::FromWebContents(web_contents()); |
94 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES); | 93 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES); |
95 | 94 |
96 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 95 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
97 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 96 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
98 NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_COOKIES)); | 97 NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_COOKIES)); |
99 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 98 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
100 content_setting_bubble_model->bubble_content(); | 99 content_setting_bubble_model->bubble_content(); |
101 std::string title = bubble_content.title; | 100 std::string title = bubble_content.title; |
102 EXPECT_FALSE(title.empty()); | 101 EXPECT_FALSE(title.empty()); |
103 ASSERT_EQ(2U, bubble_content.radio_group.radio_items.size()); | 102 ASSERT_EQ(2U, bubble_content.radio_group.radio_items.size()); |
104 EXPECT_FALSE(bubble_content.custom_link.empty()); | 103 EXPECT_FALSE(bubble_content.custom_link.empty()); |
105 EXPECT_TRUE(bubble_content.custom_link_enabled); | 104 EXPECT_TRUE(bubble_content.custom_link_enabled); |
106 EXPECT_FALSE(bubble_content.manage_link.empty()); | 105 EXPECT_FALSE(bubble_content.manage_link.empty()); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 TabSpecificContentSettings::MicrophoneCameraState microphone_camera_state = | 139 TabSpecificContentSettings::MicrophoneCameraState microphone_camera_state = |
141 TabSpecificContentSettings::MICROPHONE_ACCESSED | | 140 TabSpecificContentSettings::MICROPHONE_ACCESSED | |
142 TabSpecificContentSettings::CAMERA_ACCESSED; | 141 TabSpecificContentSettings::CAMERA_ACCESSED; |
143 content_settings->OnMediaStreamPermissionSet(security_origin, | 142 content_settings->OnMediaStreamPermissionSet(security_origin, |
144 microphone_camera_state, | 143 microphone_camera_state, |
145 GetDefaultAudioDevice(), | 144 GetDefaultAudioDevice(), |
146 GetDefaultVideoDevice(), | 145 GetDefaultVideoDevice(), |
147 std::string(), | 146 std::string(), |
148 std::string()); | 147 std::string()); |
149 | 148 |
150 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 149 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
151 new ContentSettingMediaStreamBubbleModel( | 150 new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), |
152 nullptr, web_contents(), profile())); | 151 profile())); |
153 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 152 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
154 content_setting_bubble_model->bubble_content(); | 153 content_setting_bubble_model->bubble_content(); |
155 EXPECT_EQ(bubble_content.title, | 154 EXPECT_EQ(bubble_content.title, |
156 l10n_util::GetStringUTF8(IDS_MICROPHONE_CAMERA_ALLOWED)); | 155 l10n_util::GetStringUTF8(IDS_MICROPHONE_CAMERA_ALLOWED)); |
157 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); | 156 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); |
158 EXPECT_EQ(bubble_content.radio_group.radio_items[0], | 157 EXPECT_EQ(bubble_content.radio_group.radio_items[0], |
159 l10n_util::GetStringFUTF8( | 158 l10n_util::GetStringFUTF8( |
160 IDS_ALLOWED_MEDIASTREAM_MIC_AND_CAMERA_NO_ACTION, | 159 IDS_ALLOWED_MEDIASTREAM_MIC_AND_CAMERA_NO_ACTION, |
161 url_formatter::FormatUrlForSecurityDisplay(security_origin))); | 160 url_formatter::FormatUrlForSecurityDisplay(security_origin))); |
162 EXPECT_EQ(bubble_content.radio_group.radio_items[1], | 161 EXPECT_EQ(bubble_content.radio_group.radio_items[1], |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 TabSpecificContentSettings::MICROPHONE_BLOCKED | | 194 TabSpecificContentSettings::MICROPHONE_BLOCKED | |
196 TabSpecificContentSettings::CAMERA_ACCESSED | | 195 TabSpecificContentSettings::CAMERA_ACCESSED | |
197 TabSpecificContentSettings::CAMERA_BLOCKED; | 196 TabSpecificContentSettings::CAMERA_BLOCKED; |
198 content_settings->OnMediaStreamPermissionSet(url, | 197 content_settings->OnMediaStreamPermissionSet(url, |
199 microphone_camera_state, | 198 microphone_camera_state, |
200 GetDefaultAudioDevice(), | 199 GetDefaultAudioDevice(), |
201 GetDefaultVideoDevice(), | 200 GetDefaultVideoDevice(), |
202 std::string(), | 201 std::string(), |
203 std::string()); | 202 std::string()); |
204 { | 203 { |
205 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 204 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
206 new ContentSettingMediaStreamBubbleModel( | 205 new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), |
207 nullptr, web_contents(), profile())); | 206 profile())); |
208 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 207 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
209 content_setting_bubble_model->bubble_content(); | 208 content_setting_bubble_model->bubble_content(); |
210 // Test if the correct radio item is selected for the blocked mediastream | 209 // Test if the correct radio item is selected for the blocked mediastream |
211 // setting. | 210 // setting. |
212 EXPECT_EQ(1, bubble_content.radio_group.default_item); | 211 EXPECT_EQ(1, bubble_content.radio_group.default_item); |
213 } | 212 } |
214 | 213 |
215 // Test that the media settings where not changed. | 214 // Test that the media settings where not changed. |
216 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 215 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
217 host_content_settings_map->GetContentSetting( | 216 host_content_settings_map->GetContentSetting( |
218 url, | 217 url, |
219 url, | 218 url, |
220 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, | 219 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, |
221 std::string())); | 220 std::string())); |
222 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 221 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
223 host_content_settings_map->GetContentSetting( | 222 host_content_settings_map->GetContentSetting( |
224 url, | 223 url, |
225 url, | 224 url, |
226 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, | 225 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, |
227 std::string())); | 226 std::string())); |
228 | 227 |
229 { | 228 { |
230 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 229 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
231 new ContentSettingMediaStreamBubbleModel( | 230 new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), |
232 nullptr, web_contents(), profile())); | 231 profile())); |
233 // Change the radio setting. | 232 // Change the radio setting. |
234 content_setting_bubble_model->OnRadioClicked(0); | 233 content_setting_bubble_model->OnRadioClicked(0); |
235 } | 234 } |
236 // Test that the media setting were change correctly. | 235 // Test that the media setting were change correctly. |
237 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 236 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
238 host_content_settings_map->GetContentSetting( | 237 host_content_settings_map->GetContentSetting( |
239 url, | 238 url, |
240 url, | 239 url, |
241 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, | 240 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, |
242 std::string())); | 241 std::string())); |
(...skipping 28 matching lines...) Expand all Loading... |
271 TabSpecificContentSettings::MicrophoneCameraState microphone_camera_state = | 270 TabSpecificContentSettings::MicrophoneCameraState microphone_camera_state = |
272 TabSpecificContentSettings::MICROPHONE_ACCESSED | | 271 TabSpecificContentSettings::MICROPHONE_ACCESSED | |
273 TabSpecificContentSettings::MICROPHONE_BLOCKED; | 272 TabSpecificContentSettings::MICROPHONE_BLOCKED; |
274 content_settings->OnMediaStreamPermissionSet(url, | 273 content_settings->OnMediaStreamPermissionSet(url, |
275 microphone_camera_state, | 274 microphone_camera_state, |
276 GetDefaultAudioDevice(), | 275 GetDefaultAudioDevice(), |
277 std::string(), | 276 std::string(), |
278 std::string(), | 277 std::string(), |
279 std::string()); | 278 std::string()); |
280 { | 279 { |
281 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 280 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
282 new ContentSettingMediaStreamBubbleModel( | 281 new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), |
283 nullptr, web_contents(), profile())); | 282 profile())); |
284 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 283 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
285 content_setting_bubble_model->bubble_content(); | 284 content_setting_bubble_model->bubble_content(); |
286 // Test if the correct radio item is selected for the blocked mediastream | 285 // Test if the correct radio item is selected for the blocked mediastream |
287 // setting. | 286 // setting. |
288 EXPECT_EQ(1, bubble_content.radio_group.default_item); | 287 EXPECT_EQ(1, bubble_content.radio_group.default_item); |
289 // Change the radio setting. | 288 // Change the radio setting. |
290 content_setting_bubble_model->OnRadioClicked(0); | 289 content_setting_bubble_model->OnRadioClicked(0); |
291 } | 290 } |
292 // Test that the setting was changed. | 291 // Test that the setting was changed. |
293 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 292 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
294 host_content_settings_map->GetContentSetting( | 293 host_content_settings_map->GetContentSetting( |
295 url, | 294 url, |
296 url, | 295 url, |
297 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, | 296 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, |
298 std::string())); | 297 std::string())); |
299 | 298 |
300 { | 299 { |
301 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 300 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
302 new ContentSettingMediaStreamBubbleModel( | 301 new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), |
303 nullptr, web_contents(), profile())); | 302 profile())); |
304 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 303 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
305 content_setting_bubble_model->bubble_content(); | 304 content_setting_bubble_model->bubble_content(); |
306 // Test that the reload hint is displayed. | 305 // Test that the reload hint is displayed. |
307 EXPECT_FALSE(bubble_content.custom_link_enabled); | 306 EXPECT_FALSE(bubble_content.custom_link_enabled); |
308 EXPECT_EQ(bubble_content.custom_link, l10n_util::GetStringUTF8( | 307 EXPECT_EQ(bubble_content.custom_link, l10n_util::GetStringUTF8( |
309 IDS_MEDIASTREAM_SETTING_CHANGED_MESSAGE)); | 308 IDS_MEDIASTREAM_SETTING_CHANGED_MESSAGE)); |
310 | 309 |
311 EXPECT_EQ(0, bubble_content.radio_group.default_item); | 310 EXPECT_EQ(0, bubble_content.radio_group.default_item); |
312 // Restore the radio setting (to block). | 311 // Restore the radio setting (to block). |
313 content_setting_bubble_model->OnRadioClicked(1); | 312 content_setting_bubble_model->OnRadioClicked(1); |
314 } | 313 } |
315 // Test that the media settings were changed again. | 314 // Test that the media settings were changed again. |
316 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 315 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
317 host_content_settings_map->GetContentSetting( | 316 host_content_settings_map->GetContentSetting( |
318 url, | 317 url, |
319 url, | 318 url, |
320 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, | 319 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, |
321 std::string())); | 320 std::string())); |
322 | 321 |
323 { | 322 { |
324 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 323 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
325 new ContentSettingMediaStreamBubbleModel( | 324 new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), |
326 nullptr, web_contents(), profile())); | 325 profile())); |
327 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 326 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
328 content_setting_bubble_model->bubble_content(); | 327 content_setting_bubble_model->bubble_content(); |
329 // Test that the reload hint is not displayed any more. | 328 // Test that the reload hint is not displayed any more. |
330 EXPECT_FALSE(bubble_content.custom_link_enabled); | 329 EXPECT_FALSE(bubble_content.custom_link_enabled); |
331 EXPECT_TRUE(bubble_content.custom_link.empty()); | 330 EXPECT_TRUE(bubble_content.custom_link.empty()); |
332 | 331 |
333 EXPECT_EQ(1, bubble_content.radio_group.default_item); | 332 EXPECT_EQ(1, bubble_content.radio_group.default_item); |
334 } | 333 } |
335 } | 334 } |
336 | 335 |
(...skipping 25 matching lines...) Expand all Loading... |
362 TabSpecificContentSettings::MicrophoneCameraState microphone_camera_state = | 361 TabSpecificContentSettings::MicrophoneCameraState microphone_camera_state = |
363 TabSpecificContentSettings::MICROPHONE_ACCESSED | | 362 TabSpecificContentSettings::MICROPHONE_ACCESSED | |
364 TabSpecificContentSettings::MICROPHONE_BLOCKED; | 363 TabSpecificContentSettings::MICROPHONE_BLOCKED; |
365 content_settings->OnMediaStreamPermissionSet(url, | 364 content_settings->OnMediaStreamPermissionSet(url, |
366 microphone_camera_state, | 365 microphone_camera_state, |
367 GetDefaultAudioDevice(), | 366 GetDefaultAudioDevice(), |
368 std::string(), | 367 std::string(), |
369 std::string(), | 368 std::string(), |
370 std::string()); | 369 std::string()); |
371 { | 370 { |
372 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 371 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
373 new ContentSettingMediaStreamBubbleModel( | 372 new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), |
374 nullptr, web_contents(), profile())); | 373 profile())); |
375 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 374 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
376 content_setting_bubble_model->bubble_content(); | 375 content_setting_bubble_model->bubble_content(); |
377 EXPECT_TRUE(bubble_content.custom_link.empty()); | 376 EXPECT_TRUE(bubble_content.custom_link.empty()); |
378 | 377 |
379 EXPECT_EQ(1U, bubble_content.media_menus.size()); | 378 EXPECT_EQ(1U, bubble_content.media_menus.size()); |
380 EXPECT_EQ(content::MEDIA_DEVICE_AUDIO_CAPTURE, | 379 EXPECT_EQ(content::MEDIA_DEVICE_AUDIO_CAPTURE, |
381 bubble_content.media_menus.begin()->first); | 380 bubble_content.media_menus.begin()->first); |
382 EXPECT_FALSE(bubble_content.media_menus.begin()->second.disabled); | 381 EXPECT_FALSE(bubble_content.media_menus.begin()->second.disabled); |
383 // The first audio device should be selected by default. | 382 // The first audio device should be selected by default. |
384 EXPECT_TRUE(fake_audio_device1.IsEqual( | 383 EXPECT_TRUE(fake_audio_device1.IsEqual( |
385 bubble_content.media_menus.begin()->second.selected_device)); | 384 bubble_content.media_menus.begin()->second.selected_device)); |
386 | 385 |
387 // Select a different (the second) device. | 386 // Select a different (the second) device. |
388 content_setting_bubble_model->OnMediaMenuClicked( | 387 content_setting_bubble_model->OnMediaMenuClicked( |
389 content::MEDIA_DEVICE_AUDIO_CAPTURE, | 388 content::MEDIA_DEVICE_AUDIO_CAPTURE, |
390 fake_audio_device2.id); | 389 fake_audio_device2.id); |
391 } | 390 } |
392 { | 391 { |
393 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 392 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
394 new ContentSettingMediaStreamBubbleModel( | 393 new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), |
395 nullptr, web_contents(), profile())); | 394 profile())); |
396 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 395 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
397 content_setting_bubble_model->bubble_content(); | 396 content_setting_bubble_model->bubble_content(); |
398 EXPECT_EQ(1U, bubble_content.media_menus.size()); | 397 EXPECT_EQ(1U, bubble_content.media_menus.size()); |
399 EXPECT_EQ(content::MEDIA_DEVICE_AUDIO_CAPTURE, | 398 EXPECT_EQ(content::MEDIA_DEVICE_AUDIO_CAPTURE, |
400 bubble_content.media_menus.begin()->first); | 399 bubble_content.media_menus.begin()->first); |
401 EXPECT_FALSE(bubble_content.media_menus.begin()->second.disabled); | 400 EXPECT_FALSE(bubble_content.media_menus.begin()->second.disabled); |
402 // The second audio device should be selected. | 401 // The second audio device should be selected. |
403 EXPECT_TRUE(fake_audio_device2.IsEqual( | 402 EXPECT_TRUE(fake_audio_device2.IsEqual( |
404 bubble_content.media_menus.begin()->second.selected_device)); | 403 bubble_content.media_menus.begin()->second.selected_device)); |
405 // The "settings changed" message should not be displayed when there is no | 404 // The "settings changed" message should not be displayed when there is no |
406 // active capture. | 405 // active capture. |
407 EXPECT_FALSE(bubble_content.custom_link_enabled); | 406 EXPECT_FALSE(bubble_content.custom_link_enabled); |
408 EXPECT_TRUE(bubble_content.custom_link.empty()); | 407 EXPECT_TRUE(bubble_content.custom_link.empty()); |
409 } | 408 } |
410 | 409 |
411 // Simulate that an audio stream is being captured. | 410 // Simulate that an audio stream is being captured. |
412 scoped_refptr<MediaStreamCaptureIndicator> indicator = | 411 scoped_refptr<MediaStreamCaptureIndicator> indicator = |
413 MediaCaptureDevicesDispatcher::GetInstance()-> | 412 MediaCaptureDevicesDispatcher::GetInstance()-> |
414 GetMediaStreamCaptureIndicator(); | 413 GetMediaStreamCaptureIndicator(); |
415 scoped_ptr<content::MediaStreamUI> media_stream_ui = | 414 std::unique_ptr<content::MediaStreamUI> media_stream_ui = |
416 indicator->RegisterMediaStream(web_contents(), audio_devices); | 415 indicator->RegisterMediaStream(web_contents(), audio_devices); |
417 media_stream_ui->OnStarted(base::Closure()); | 416 media_stream_ui->OnStarted(base::Closure()); |
418 microphone_camera_state &= ~TabSpecificContentSettings::MICROPHONE_BLOCKED; | 417 microphone_camera_state &= ~TabSpecificContentSettings::MICROPHONE_BLOCKED; |
419 content_settings->OnMediaStreamPermissionSet(url, | 418 content_settings->OnMediaStreamPermissionSet(url, |
420 microphone_camera_state, | 419 microphone_camera_state, |
421 GetDefaultAudioDevice(), | 420 GetDefaultAudioDevice(), |
422 std::string(), | 421 std::string(), |
423 std::string(), | 422 std::string(), |
424 std::string()); | 423 std::string()); |
425 | 424 |
426 { | 425 { |
427 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 426 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
428 new ContentSettingMediaStreamBubbleModel( | 427 new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), |
429 nullptr, web_contents(), profile())); | 428 profile())); |
430 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 429 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
431 content_setting_bubble_model->bubble_content(); | 430 content_setting_bubble_model->bubble_content(); |
432 // Settings not changed yet, so the "settings changed" message should not be | 431 // Settings not changed yet, so the "settings changed" message should not be |
433 // shown. | 432 // shown. |
434 EXPECT_TRUE(bubble_content.custom_link.empty()); | 433 EXPECT_TRUE(bubble_content.custom_link.empty()); |
435 | 434 |
436 EXPECT_EQ(1U, bubble_content.media_menus.size()); | 435 EXPECT_EQ(1U, bubble_content.media_menus.size()); |
437 EXPECT_EQ(content::MEDIA_DEVICE_AUDIO_CAPTURE, | 436 EXPECT_EQ(content::MEDIA_DEVICE_AUDIO_CAPTURE, |
438 bubble_content.media_menus.begin()->first); | 437 bubble_content.media_menus.begin()->first); |
439 EXPECT_FALSE(bubble_content.media_menus.begin()->second.disabled); | 438 EXPECT_FALSE(bubble_content.media_menus.begin()->second.disabled); |
440 EXPECT_TRUE(fake_audio_device2.IsEqual( | 439 EXPECT_TRUE(fake_audio_device2.IsEqual( |
441 bubble_content.media_menus.begin()->second.selected_device)); | 440 bubble_content.media_menus.begin()->second.selected_device)); |
442 | 441 |
443 // Select a different different device. | 442 // Select a different different device. |
444 content_setting_bubble_model->OnMediaMenuClicked( | 443 content_setting_bubble_model->OnMediaMenuClicked( |
445 content::MEDIA_DEVICE_AUDIO_CAPTURE, | 444 content::MEDIA_DEVICE_AUDIO_CAPTURE, |
446 fake_audio_device3.id); | 445 fake_audio_device3.id); |
447 } | 446 } |
448 | 447 |
449 { | 448 { |
450 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 449 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
451 new ContentSettingMediaStreamBubbleModel( | 450 new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), |
452 nullptr, web_contents(), profile())); | 451 profile())); |
453 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 452 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
454 content_setting_bubble_model->bubble_content(); | 453 content_setting_bubble_model->bubble_content(); |
455 // Test that the reload hint is displayed. | 454 // Test that the reload hint is displayed. |
456 EXPECT_FALSE(bubble_content.custom_link_enabled); | 455 EXPECT_FALSE(bubble_content.custom_link_enabled); |
457 EXPECT_EQ(bubble_content.custom_link, l10n_util::GetStringUTF8( | 456 EXPECT_EQ(bubble_content.custom_link, l10n_util::GetStringUTF8( |
458 IDS_MEDIASTREAM_SETTING_CHANGED_MESSAGE)); | 457 IDS_MEDIASTREAM_SETTING_CHANGED_MESSAGE)); |
459 } | 458 } |
460 | 459 |
461 // Simulate that yet another audio stream capture request was initiated. | 460 // Simulate that yet another audio stream capture request was initiated. |
462 microphone_camera_state |= TabSpecificContentSettings::MICROPHONE_BLOCKED; | 461 microphone_camera_state |= TabSpecificContentSettings::MICROPHONE_BLOCKED; |
463 content_settings->OnMediaStreamPermissionSet(url, | 462 content_settings->OnMediaStreamPermissionSet(url, |
464 microphone_camera_state, | 463 microphone_camera_state, |
465 GetDefaultAudioDevice(), | 464 GetDefaultAudioDevice(), |
466 std::string(), | 465 std::string(), |
467 std::string(), | 466 std::string(), |
468 std::string()); | 467 std::string()); |
469 | 468 |
470 { | 469 { |
471 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 470 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
472 new ContentSettingMediaStreamBubbleModel( | 471 new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), |
473 nullptr, web_contents(), profile())); | 472 profile())); |
474 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 473 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
475 content_setting_bubble_model->bubble_content(); | 474 content_setting_bubble_model->bubble_content(); |
476 // Test that the reload hint is not displayed any more, because this is a | 475 // Test that the reload hint is not displayed any more, because this is a |
477 // new permission request. | 476 // new permission request. |
478 EXPECT_FALSE(bubble_content.custom_link_enabled); | 477 EXPECT_FALSE(bubble_content.custom_link_enabled); |
479 EXPECT_TRUE(bubble_content.custom_link.empty()); | 478 EXPECT_TRUE(bubble_content.custom_link.empty()); |
480 | 479 |
481 // Though the audio menu setting should have persisted. | 480 // Though the audio menu setting should have persisted. |
482 EXPECT_EQ(1U, bubble_content.media_menus.size()); | 481 EXPECT_EQ(1U, bubble_content.media_menus.size()); |
483 EXPECT_EQ(content::MEDIA_DEVICE_AUDIO_CAPTURE, | 482 EXPECT_EQ(content::MEDIA_DEVICE_AUDIO_CAPTURE, |
(...skipping 15 matching lines...) Expand all Loading... |
499 GURL security_origin("http://" + request_host); | 498 GURL security_origin("http://" + request_host); |
500 TabSpecificContentSettings::MicrophoneCameraState microphone_camera_state = | 499 TabSpecificContentSettings::MicrophoneCameraState microphone_camera_state = |
501 TabSpecificContentSettings::MICROPHONE_ACCESSED; | 500 TabSpecificContentSettings::MICROPHONE_ACCESSED; |
502 content_settings->OnMediaStreamPermissionSet(security_origin, | 501 content_settings->OnMediaStreamPermissionSet(security_origin, |
503 microphone_camera_state, | 502 microphone_camera_state, |
504 GetDefaultAudioDevice(), | 503 GetDefaultAudioDevice(), |
505 std::string(), | 504 std::string(), |
506 std::string(), | 505 std::string(), |
507 std::string()); | 506 std::string()); |
508 | 507 |
509 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 508 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
510 new ContentSettingMediaStreamBubbleModel( | 509 new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), |
511 nullptr, web_contents(), profile())); | 510 profile())); |
512 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 511 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
513 content_setting_bubble_model->bubble_content(); | 512 content_setting_bubble_model->bubble_content(); |
514 EXPECT_EQ(bubble_content.title, | 513 EXPECT_EQ(bubble_content.title, |
515 l10n_util::GetStringUTF8(IDS_MICROPHONE_ACCESSED)); | 514 l10n_util::GetStringUTF8(IDS_MICROPHONE_ACCESSED)); |
516 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); | 515 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); |
517 EXPECT_EQ(bubble_content.radio_group.radio_items[0], | 516 EXPECT_EQ(bubble_content.radio_group.radio_items[0], |
518 l10n_util::GetStringFUTF8( | 517 l10n_util::GetStringFUTF8( |
519 IDS_ALLOWED_MEDIASTREAM_MIC_NO_ACTION, | 518 IDS_ALLOWED_MEDIASTREAM_MIC_NO_ACTION, |
520 url_formatter::FormatUrlForSecurityDisplay(security_origin))); | 519 url_formatter::FormatUrlForSecurityDisplay(security_origin))); |
521 EXPECT_EQ(bubble_content.radio_group.radio_items[1], | 520 EXPECT_EQ(bubble_content.radio_group.radio_items[1], |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 GURL security_origin("http://" + request_host); | 571 GURL security_origin("http://" + request_host); |
573 TabSpecificContentSettings::MicrophoneCameraState microphone_camera_state = | 572 TabSpecificContentSettings::MicrophoneCameraState microphone_camera_state = |
574 TabSpecificContentSettings::CAMERA_ACCESSED; | 573 TabSpecificContentSettings::CAMERA_ACCESSED; |
575 content_settings->OnMediaStreamPermissionSet(security_origin, | 574 content_settings->OnMediaStreamPermissionSet(security_origin, |
576 microphone_camera_state, | 575 microphone_camera_state, |
577 std::string(), | 576 std::string(), |
578 GetDefaultVideoDevice(), | 577 GetDefaultVideoDevice(), |
579 std::string(), | 578 std::string(), |
580 std::string()); | 579 std::string()); |
581 | 580 |
582 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 581 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
583 new ContentSettingMediaStreamBubbleModel( | 582 new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), |
584 nullptr, web_contents(), profile())); | 583 profile())); |
585 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 584 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
586 content_setting_bubble_model->bubble_content(); | 585 content_setting_bubble_model->bubble_content(); |
587 EXPECT_EQ(bubble_content.title, | 586 EXPECT_EQ(bubble_content.title, |
588 l10n_util::GetStringUTF8(IDS_CAMERA_ACCESSED)); | 587 l10n_util::GetStringUTF8(IDS_CAMERA_ACCESSED)); |
589 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); | 588 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); |
590 EXPECT_EQ(bubble_content.radio_group.radio_items[0], | 589 EXPECT_EQ(bubble_content.radio_group.radio_items[0], |
591 l10n_util::GetStringFUTF8( | 590 l10n_util::GetStringFUTF8( |
592 IDS_ALLOWED_MEDIASTREAM_CAMERA_NO_ACTION, | 591 IDS_ALLOWED_MEDIASTREAM_CAMERA_NO_ACTION, |
593 url_formatter::FormatUrlForSecurityDisplay(security_origin))); | 592 url_formatter::FormatUrlForSecurityDisplay(security_origin))); |
594 EXPECT_EQ(bubble_content.radio_group.radio_items[1], | 593 EXPECT_EQ(bubble_content.radio_group.radio_items[1], |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 // Firstly, add microphone access. | 646 // Firstly, add microphone access. |
648 TabSpecificContentSettings::MicrophoneCameraState microphone_camera_state = | 647 TabSpecificContentSettings::MicrophoneCameraState microphone_camera_state = |
649 TabSpecificContentSettings::MICROPHONE_ACCESSED; | 648 TabSpecificContentSettings::MICROPHONE_ACCESSED; |
650 content_settings->OnMediaStreamPermissionSet(security_origin, | 649 content_settings->OnMediaStreamPermissionSet(security_origin, |
651 microphone_camera_state, | 650 microphone_camera_state, |
652 GetDefaultAudioDevice(), | 651 GetDefaultAudioDevice(), |
653 std::string(), | 652 std::string(), |
654 std::string(), | 653 std::string(), |
655 std::string()); | 654 std::string()); |
656 | 655 |
657 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 656 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
658 new ContentSettingMediaStreamBubbleModel( | 657 new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), |
659 nullptr, web_contents(), profile())); | 658 profile())); |
660 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 659 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
661 content_setting_bubble_model->bubble_content(); | 660 content_setting_bubble_model->bubble_content(); |
662 EXPECT_EQ(bubble_content.title, | 661 EXPECT_EQ(bubble_content.title, |
663 l10n_util::GetStringUTF8(IDS_MICROPHONE_ACCESSED)); | 662 l10n_util::GetStringUTF8(IDS_MICROPHONE_ACCESSED)); |
664 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); | 663 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); |
665 EXPECT_EQ(bubble_content.radio_group.radio_items[0], | 664 EXPECT_EQ(bubble_content.radio_group.radio_items[0], |
666 l10n_util::GetStringFUTF8( | 665 l10n_util::GetStringFUTF8( |
667 IDS_ALLOWED_MEDIASTREAM_MIC_NO_ACTION, | 666 IDS_ALLOWED_MEDIASTREAM_MIC_NO_ACTION, |
668 url_formatter::FormatUrlForSecurityDisplay(security_origin))); | 667 url_formatter::FormatUrlForSecurityDisplay(security_origin))); |
669 EXPECT_EQ(bubble_content.radio_group.radio_items[1], | 668 EXPECT_EQ(bubble_content.radio_group.radio_items[1], |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 } | 702 } |
704 | 703 |
705 TEST_F(ContentSettingBubbleModelTest, Plugins) { | 704 TEST_F(ContentSettingBubbleModelTest, Plugins) { |
706 TabSpecificContentSettings* content_settings = | 705 TabSpecificContentSettings* content_settings = |
707 TabSpecificContentSettings::FromWebContents(web_contents()); | 706 TabSpecificContentSettings::FromWebContents(web_contents()); |
708 const base::string16 plugin_name = base::ASCIIToUTF16("plugin_name"); | 707 const base::string16 plugin_name = base::ASCIIToUTF16("plugin_name"); |
709 | 708 |
710 content_settings->OnContentBlockedWithDetail(CONTENT_SETTINGS_TYPE_PLUGINS, | 709 content_settings->OnContentBlockedWithDetail(CONTENT_SETTINGS_TYPE_PLUGINS, |
711 plugin_name); | 710 plugin_name); |
712 | 711 |
713 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 712 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
714 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 713 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
715 NULL, web_contents(), profile(), | 714 NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_PLUGINS)); |
716 CONTENT_SETTINGS_TYPE_PLUGINS)); | |
717 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 715 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
718 content_setting_bubble_model->bubble_content(); | 716 content_setting_bubble_model->bubble_content(); |
719 EXPECT_FALSE(bubble_content.title.empty()); | 717 EXPECT_FALSE(bubble_content.title.empty()); |
720 ASSERT_EQ(1U, bubble_content.list_items.size()); | 718 ASSERT_EQ(1U, bubble_content.list_items.size()); |
721 EXPECT_EQ(plugin_name, | 719 EXPECT_EQ(plugin_name, |
722 base::ASCIIToUTF16(bubble_content.list_items[0].title)); | 720 base::ASCIIToUTF16(bubble_content.list_items[0].title)); |
723 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); | 721 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); |
724 EXPECT_FALSE(bubble_content.custom_link.empty()); | 722 EXPECT_FALSE(bubble_content.custom_link.empty()); |
725 EXPECT_TRUE(bubble_content.custom_link_enabled); | 723 EXPECT_TRUE(bubble_content.custom_link_enabled); |
726 EXPECT_FALSE(bubble_content.manage_link.empty()); | 724 EXPECT_FALSE(bubble_content.manage_link.empty()); |
727 EXPECT_FALSE(bubble_content.learn_more_link.empty()); | 725 EXPECT_FALSE(bubble_content.learn_more_link.empty()); |
728 } | 726 } |
729 | 727 |
730 TEST_F(ContentSettingBubbleModelTest, PepperBroker) { | 728 TEST_F(ContentSettingBubbleModelTest, PepperBroker) { |
731 TabSpecificContentSettings* content_settings = | 729 TabSpecificContentSettings* content_settings = |
732 TabSpecificContentSettings::FromWebContents(web_contents()); | 730 TabSpecificContentSettings::FromWebContents(web_contents()); |
733 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_PPAPI_BROKER); | 731 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_PPAPI_BROKER); |
734 | 732 |
735 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 733 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
736 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 734 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
737 NULL, web_contents(), profile(), | 735 NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_PPAPI_BROKER)); |
738 CONTENT_SETTINGS_TYPE_PPAPI_BROKER)); | |
739 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 736 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
740 content_setting_bubble_model->bubble_content(); | 737 content_setting_bubble_model->bubble_content(); |
741 | 738 |
742 std::string title = bubble_content.title; | 739 std::string title = bubble_content.title; |
743 EXPECT_FALSE(title.empty()); | 740 EXPECT_FALSE(title.empty()); |
744 ASSERT_EQ(2U, bubble_content.radio_group.radio_items.size()); | 741 ASSERT_EQ(2U, bubble_content.radio_group.radio_items.size()); |
745 std::string radio1 = bubble_content.radio_group.radio_items[0]; | 742 std::string radio1 = bubble_content.radio_group.radio_items[0]; |
746 std::string radio2 = bubble_content.radio_group.radio_items[1]; | 743 std::string radio2 = bubble_content.radio_group.radio_items[1]; |
747 EXPECT_FALSE(bubble_content.custom_link_enabled); | 744 EXPECT_FALSE(bubble_content.custom_link_enabled); |
748 EXPECT_FALSE(bubble_content.manage_link.empty()); | 745 EXPECT_FALSE(bubble_content.manage_link.empty()); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 setting_map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_GEOLOCATION, | 796 setting_map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_GEOLOCATION, |
800 CONTENT_SETTING_BLOCK); | 797 CONTENT_SETTING_BLOCK); |
801 CheckGeolocationBubble(2, true, false); | 798 CheckGeolocationBubble(2, true, false); |
802 } | 799 } |
803 | 800 |
804 TEST_F(ContentSettingBubbleModelTest, FileURL) { | 801 TEST_F(ContentSettingBubbleModelTest, FileURL) { |
805 std::string file_url("file:///tmp/test.html"); | 802 std::string file_url("file:///tmp/test.html"); |
806 NavigateAndCommit(GURL(file_url)); | 803 NavigateAndCommit(GURL(file_url)); |
807 TabSpecificContentSettings::FromWebContents(web_contents())->OnContentBlocked( | 804 TabSpecificContentSettings::FromWebContents(web_contents())->OnContentBlocked( |
808 CONTENT_SETTINGS_TYPE_IMAGES); | 805 CONTENT_SETTINGS_TYPE_IMAGES); |
809 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 806 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
810 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 807 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
811 nullptr, web_contents(), profile(), CONTENT_SETTINGS_TYPE_IMAGES)); | 808 nullptr, web_contents(), profile(), CONTENT_SETTINGS_TYPE_IMAGES)); |
812 std::string title = | 809 std::string title = |
813 content_setting_bubble_model->bubble_content().radio_group.radio_items[0]; | 810 content_setting_bubble_model->bubble_content().radio_group.radio_items[0]; |
814 ASSERT_NE(std::string::npos, title.find(file_url)); | 811 ASSERT_NE(std::string::npos, title.find(file_url)); |
815 } | 812 } |
816 | 813 |
817 TEST_F(ContentSettingBubbleModelTest, RegisterProtocolHandler) { | 814 TEST_F(ContentSettingBubbleModelTest, RegisterProtocolHandler) { |
818 const GURL page_url("http://toplevel.example/"); | 815 const GURL page_url("http://toplevel.example/"); |
819 NavigateAndCommit(page_url); | 816 NavigateAndCommit(page_url); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 { | 912 { |
916 ProtocolHandler handler = registry.GetHandlerFor("mailto"); | 913 ProtocolHandler handler = registry.GetHandlerFor("mailto"); |
917 ASSERT_FALSE(handler.IsEmpty()); | 914 ASSERT_FALSE(handler.IsEmpty()); |
918 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 915 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
919 content_settings->pending_protocol_handler_setting()); | 916 content_settings->pending_protocol_handler_setting()); |
920 EXPECT_FALSE(registry.IsIgnored(test_handler)); | 917 EXPECT_FALSE(registry.IsIgnored(test_handler)); |
921 } | 918 } |
922 | 919 |
923 registry.Shutdown(); | 920 registry.Shutdown(); |
924 } | 921 } |
OLD | NEW |