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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 TEST_F(ContentSettingBubbleModelTest, Cookies) { | 90 TEST_F(ContentSettingBubbleModelTest, Cookies) { |
91 TabSpecificContentSettings* content_settings = | 91 TabSpecificContentSettings* content_settings = |
92 TabSpecificContentSettings::FromWebContents(web_contents()); | 92 TabSpecificContentSettings::FromWebContents(web_contents()); |
93 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES); | 93 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES); |
94 | 94 |
95 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 95 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
96 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 96 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
97 NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_COOKIES)); | 97 NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_COOKIES)); |
98 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 98 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
99 content_setting_bubble_model->bubble_content(); | 99 content_setting_bubble_model->bubble_content(); |
100 std::string title = bubble_content.title; | 100 base::string16 title = bubble_content.title; |
101 EXPECT_FALSE(title.empty()); | 101 EXPECT_FALSE(title.empty()); |
102 ASSERT_EQ(2U, bubble_content.radio_group.radio_items.size()); | 102 ASSERT_EQ(2U, bubble_content.radio_group.radio_items.size()); |
103 EXPECT_FALSE(bubble_content.custom_link.empty()); | 103 EXPECT_FALSE(bubble_content.custom_link.empty()); |
104 EXPECT_TRUE(bubble_content.custom_link_enabled); | 104 EXPECT_TRUE(bubble_content.custom_link_enabled); |
105 EXPECT_FALSE(bubble_content.manage_link.empty()); | 105 EXPECT_FALSE(bubble_content.manage_link.empty()); |
106 | 106 |
107 content_settings->ClearCookieSpecificContentSettings(); | 107 content_settings->ClearCookieSpecificContentSettings(); |
108 content_settings->OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); | 108 content_settings->OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); |
109 content_setting_bubble_model.reset( | 109 content_setting_bubble_model.reset( |
110 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 110 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 GetDefaultVideoDevice(), | 145 GetDefaultVideoDevice(), |
146 std::string(), | 146 std::string(), |
147 std::string()); | 147 std::string()); |
148 | 148 |
149 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 149 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
150 new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), | 150 new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), |
151 profile())); | 151 profile())); |
152 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 152 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
153 content_setting_bubble_model->bubble_content(); | 153 content_setting_bubble_model->bubble_content(); |
154 EXPECT_EQ(bubble_content.title, | 154 EXPECT_EQ(bubble_content.title, |
155 l10n_util::GetStringUTF8(IDS_MICROPHONE_CAMERA_ALLOWED)); | 155 l10n_util::GetStringUTF16(IDS_MICROPHONE_CAMERA_ALLOWED)); |
156 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); | 156 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); |
157 EXPECT_EQ(bubble_content.radio_group.radio_items[0], | 157 EXPECT_EQ(bubble_content.radio_group.radio_items[0], |
158 l10n_util::GetStringFUTF8( | 158 l10n_util::GetStringFUTF8( |
159 IDS_ALLOWED_MEDIASTREAM_MIC_AND_CAMERA_NO_ACTION, | 159 IDS_ALLOWED_MEDIASTREAM_MIC_AND_CAMERA_NO_ACTION, |
160 url_formatter::FormatUrlForSecurityDisplay(security_origin))); | 160 url_formatter::FormatUrlForSecurityDisplay(security_origin))); |
161 EXPECT_EQ(bubble_content.radio_group.radio_items[1], | 161 EXPECT_EQ(bubble_content.radio_group.radio_items[1], |
162 l10n_util::GetStringUTF8( | 162 l10n_util::GetStringUTF8( |
163 IDS_ALLOWED_MEDIASTREAM_MIC_AND_CAMERA_BLOCK)); | 163 IDS_ALLOWED_MEDIASTREAM_MIC_AND_CAMERA_BLOCK)); |
164 EXPECT_EQ(0, bubble_content.radio_group.default_item); | 164 EXPECT_EQ(0, bubble_content.radio_group.default_item); |
165 EXPECT_TRUE(bubble_content.custom_link.empty()); | 165 EXPECT_TRUE(bubble_content.custom_link.empty()); |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 std::string(), | 504 std::string(), |
505 std::string(), | 505 std::string(), |
506 std::string()); | 506 std::string()); |
507 | 507 |
508 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 508 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
509 new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), | 509 new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), |
510 profile())); | 510 profile())); |
511 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 511 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
512 content_setting_bubble_model->bubble_content(); | 512 content_setting_bubble_model->bubble_content(); |
513 EXPECT_EQ(bubble_content.title, | 513 EXPECT_EQ(bubble_content.title, |
514 l10n_util::GetStringUTF8(IDS_MICROPHONE_ACCESSED)); | 514 l10n_util::GetStringUTF16(IDS_MICROPHONE_ACCESSED)); |
515 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); | 515 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); |
516 EXPECT_EQ(bubble_content.radio_group.radio_items[0], | 516 EXPECT_EQ(bubble_content.radio_group.radio_items[0], |
517 l10n_util::GetStringFUTF8( | 517 l10n_util::GetStringFUTF8( |
518 IDS_ALLOWED_MEDIASTREAM_MIC_NO_ACTION, | 518 IDS_ALLOWED_MEDIASTREAM_MIC_NO_ACTION, |
519 url_formatter::FormatUrlForSecurityDisplay(security_origin))); | 519 url_formatter::FormatUrlForSecurityDisplay(security_origin))); |
520 EXPECT_EQ(bubble_content.radio_group.radio_items[1], | 520 EXPECT_EQ(bubble_content.radio_group.radio_items[1], |
521 l10n_util::GetStringUTF8( | 521 l10n_util::GetStringUTF8( |
522 IDS_ALLOWED_MEDIASTREAM_MIC_BLOCK)); | 522 IDS_ALLOWED_MEDIASTREAM_MIC_BLOCK)); |
523 EXPECT_EQ(0, bubble_content.radio_group.default_item); | 523 EXPECT_EQ(0, bubble_content.radio_group.default_item); |
524 EXPECT_TRUE(bubble_content.custom_link.empty()); | 524 EXPECT_TRUE(bubble_content.custom_link.empty()); |
(...skipping 10 matching lines...) Expand all Loading... |
535 GetDefaultAudioDevice(), | 535 GetDefaultAudioDevice(), |
536 std::string(), | 536 std::string(), |
537 std::string(), | 537 std::string(), |
538 std::string()); | 538 std::string()); |
539 content_setting_bubble_model.reset( | 539 content_setting_bubble_model.reset( |
540 new ContentSettingMediaStreamBubbleModel( | 540 new ContentSettingMediaStreamBubbleModel( |
541 nullptr, web_contents(), profile())); | 541 nullptr, web_contents(), profile())); |
542 const ContentSettingBubbleModel::BubbleContent& new_bubble_content = | 542 const ContentSettingBubbleModel::BubbleContent& new_bubble_content = |
543 content_setting_bubble_model->bubble_content(); | 543 content_setting_bubble_model->bubble_content(); |
544 EXPECT_EQ(new_bubble_content.title, | 544 EXPECT_EQ(new_bubble_content.title, |
545 l10n_util::GetStringUTF8(IDS_MICROPHONE_BLOCKED)); | 545 l10n_util::GetStringUTF16(IDS_MICROPHONE_BLOCKED)); |
546 EXPECT_EQ(2U, new_bubble_content.radio_group.radio_items.size()); | 546 EXPECT_EQ(2U, new_bubble_content.radio_group.radio_items.size()); |
547 EXPECT_EQ(new_bubble_content.radio_group.radio_items[0], | 547 EXPECT_EQ(new_bubble_content.radio_group.radio_items[0], |
548 l10n_util::GetStringFUTF8( | 548 l10n_util::GetStringFUTF8( |
549 IDS_BLOCKED_MEDIASTREAM_MIC_ASK, | 549 IDS_BLOCKED_MEDIASTREAM_MIC_ASK, |
550 url_formatter::FormatUrlForSecurityDisplay(security_origin))); | 550 url_formatter::FormatUrlForSecurityDisplay(security_origin))); |
551 EXPECT_EQ(new_bubble_content.radio_group.radio_items[1], | 551 EXPECT_EQ(new_bubble_content.radio_group.radio_items[1], |
552 l10n_util::GetStringUTF8( | 552 l10n_util::GetStringUTF8( |
553 IDS_BLOCKED_MEDIASTREAM_MIC_NO_ACTION)); | 553 IDS_BLOCKED_MEDIASTREAM_MIC_NO_ACTION)); |
554 EXPECT_EQ(1, new_bubble_content.radio_group.default_item); | 554 EXPECT_EQ(1, new_bubble_content.radio_group.default_item); |
555 EXPECT_TRUE(new_bubble_content.custom_link.empty()); | 555 EXPECT_TRUE(new_bubble_content.custom_link.empty()); |
(...skipping 21 matching lines...) Expand all Loading... |
577 GetDefaultVideoDevice(), | 577 GetDefaultVideoDevice(), |
578 std::string(), | 578 std::string(), |
579 std::string()); | 579 std::string()); |
580 | 580 |
581 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 581 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
582 new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), | 582 new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), |
583 profile())); | 583 profile())); |
584 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 584 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
585 content_setting_bubble_model->bubble_content(); | 585 content_setting_bubble_model->bubble_content(); |
586 EXPECT_EQ(bubble_content.title, | 586 EXPECT_EQ(bubble_content.title, |
587 l10n_util::GetStringUTF8(IDS_CAMERA_ACCESSED)); | 587 l10n_util::GetStringUTF16(IDS_CAMERA_ACCESSED)); |
588 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); | 588 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); |
589 EXPECT_EQ(bubble_content.radio_group.radio_items[0], | 589 EXPECT_EQ(bubble_content.radio_group.radio_items[0], |
590 l10n_util::GetStringFUTF8( | 590 l10n_util::GetStringFUTF8( |
591 IDS_ALLOWED_MEDIASTREAM_CAMERA_NO_ACTION, | 591 IDS_ALLOWED_MEDIASTREAM_CAMERA_NO_ACTION, |
592 url_formatter::FormatUrlForSecurityDisplay(security_origin))); | 592 url_formatter::FormatUrlForSecurityDisplay(security_origin))); |
593 EXPECT_EQ(bubble_content.radio_group.radio_items[1], | 593 EXPECT_EQ(bubble_content.radio_group.radio_items[1], |
594 l10n_util::GetStringUTF8( | 594 l10n_util::GetStringUTF8( |
595 IDS_ALLOWED_MEDIASTREAM_CAMERA_BLOCK)); | 595 IDS_ALLOWED_MEDIASTREAM_CAMERA_BLOCK)); |
596 EXPECT_EQ(0, bubble_content.radio_group.default_item); | 596 EXPECT_EQ(0, bubble_content.radio_group.default_item); |
597 EXPECT_TRUE(bubble_content.custom_link.empty()); | 597 EXPECT_TRUE(bubble_content.custom_link.empty()); |
(...skipping 10 matching lines...) Expand all Loading... |
608 std::string(), | 608 std::string(), |
609 GetDefaultVideoDevice(), | 609 GetDefaultVideoDevice(), |
610 std::string(), | 610 std::string(), |
611 std::string()); | 611 std::string()); |
612 content_setting_bubble_model.reset( | 612 content_setting_bubble_model.reset( |
613 new ContentSettingMediaStreamBubbleModel( | 613 new ContentSettingMediaStreamBubbleModel( |
614 nullptr, web_contents(), profile())); | 614 nullptr, web_contents(), profile())); |
615 const ContentSettingBubbleModel::BubbleContent& new_bubble_content = | 615 const ContentSettingBubbleModel::BubbleContent& new_bubble_content = |
616 content_setting_bubble_model->bubble_content(); | 616 content_setting_bubble_model->bubble_content(); |
617 EXPECT_EQ(new_bubble_content.title, | 617 EXPECT_EQ(new_bubble_content.title, |
618 l10n_util::GetStringUTF8(IDS_CAMERA_BLOCKED)); | 618 l10n_util::GetStringUTF16(IDS_CAMERA_BLOCKED)); |
619 EXPECT_EQ(2U, new_bubble_content.radio_group.radio_items.size()); | 619 EXPECT_EQ(2U, new_bubble_content.radio_group.radio_items.size()); |
620 EXPECT_EQ(new_bubble_content.radio_group.radio_items[0], | 620 EXPECT_EQ(new_bubble_content.radio_group.radio_items[0], |
621 l10n_util::GetStringFUTF8( | 621 l10n_util::GetStringFUTF8( |
622 IDS_BLOCKED_MEDIASTREAM_CAMERA_ASK, | 622 IDS_BLOCKED_MEDIASTREAM_CAMERA_ASK, |
623 url_formatter::FormatUrlForSecurityDisplay(security_origin))); | 623 url_formatter::FormatUrlForSecurityDisplay(security_origin))); |
624 EXPECT_EQ(new_bubble_content.radio_group.radio_items[1], | 624 EXPECT_EQ(new_bubble_content.radio_group.radio_items[1], |
625 l10n_util::GetStringUTF8( | 625 l10n_util::GetStringUTF8( |
626 IDS_BLOCKED_MEDIASTREAM_CAMERA_NO_ACTION)); | 626 IDS_BLOCKED_MEDIASTREAM_CAMERA_NO_ACTION)); |
627 EXPECT_EQ(1, new_bubble_content.radio_group.default_item); | 627 EXPECT_EQ(1, new_bubble_content.radio_group.default_item); |
628 EXPECT_TRUE(new_bubble_content.custom_link.empty()); | 628 EXPECT_TRUE(new_bubble_content.custom_link.empty()); |
(...skipping 23 matching lines...) Expand all Loading... |
652 std::string(), | 652 std::string(), |
653 std::string(), | 653 std::string(), |
654 std::string()); | 654 std::string()); |
655 | 655 |
656 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 656 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
657 new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), | 657 new ContentSettingMediaStreamBubbleModel(nullptr, web_contents(), |
658 profile())); | 658 profile())); |
659 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 659 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
660 content_setting_bubble_model->bubble_content(); | 660 content_setting_bubble_model->bubble_content(); |
661 EXPECT_EQ(bubble_content.title, | 661 EXPECT_EQ(bubble_content.title, |
662 l10n_util::GetStringUTF8(IDS_MICROPHONE_ACCESSED)); | 662 l10n_util::GetStringUTF16(IDS_MICROPHONE_ACCESSED)); |
663 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); | 663 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); |
664 EXPECT_EQ(bubble_content.radio_group.radio_items[0], | 664 EXPECT_EQ(bubble_content.radio_group.radio_items[0], |
665 l10n_util::GetStringFUTF8( | 665 l10n_util::GetStringFUTF8( |
666 IDS_ALLOWED_MEDIASTREAM_MIC_NO_ACTION, | 666 IDS_ALLOWED_MEDIASTREAM_MIC_NO_ACTION, |
667 url_formatter::FormatUrlForSecurityDisplay(security_origin))); | 667 url_formatter::FormatUrlForSecurityDisplay(security_origin))); |
668 EXPECT_EQ(bubble_content.radio_group.radio_items[1], | 668 EXPECT_EQ(bubble_content.radio_group.radio_items[1], |
669 l10n_util::GetStringUTF8( | 669 l10n_util::GetStringUTF8( |
670 IDS_ALLOWED_MEDIASTREAM_MIC_BLOCK)); | 670 IDS_ALLOWED_MEDIASTREAM_MIC_BLOCK)); |
671 EXPECT_EQ(0, bubble_content.radio_group.default_item); | 671 EXPECT_EQ(0, bubble_content.radio_group.default_item); |
672 EXPECT_EQ(1U, bubble_content.media_menus.size()); | 672 EXPECT_EQ(1U, bubble_content.media_menus.size()); |
673 EXPECT_EQ(content::MEDIA_DEVICE_AUDIO_CAPTURE, | 673 EXPECT_EQ(content::MEDIA_DEVICE_AUDIO_CAPTURE, |
674 bubble_content.media_menus.begin()->first); | 674 bubble_content.media_menus.begin()->first); |
675 | 675 |
676 // Then add camera access. | 676 // Then add camera access. |
677 microphone_camera_state |= TabSpecificContentSettings::CAMERA_ACCESSED; | 677 microphone_camera_state |= TabSpecificContentSettings::CAMERA_ACCESSED; |
678 content_settings->OnMediaStreamPermissionSet(security_origin, | 678 content_settings->OnMediaStreamPermissionSet(security_origin, |
679 microphone_camera_state, | 679 microphone_camera_state, |
680 GetDefaultAudioDevice(), | 680 GetDefaultAudioDevice(), |
681 GetDefaultVideoDevice(), | 681 GetDefaultVideoDevice(), |
682 std::string(), | 682 std::string(), |
683 std::string()); | 683 std::string()); |
684 | 684 |
685 content_setting_bubble_model.reset( | 685 content_setting_bubble_model.reset( |
686 new ContentSettingMediaStreamBubbleModel( | 686 new ContentSettingMediaStreamBubbleModel( |
687 nullptr, web_contents(), profile())); | 687 nullptr, web_contents(), profile())); |
688 const ContentSettingBubbleModel::BubbleContent& new_bubble_content = | 688 const ContentSettingBubbleModel::BubbleContent& new_bubble_content = |
689 content_setting_bubble_model->bubble_content(); | 689 content_setting_bubble_model->bubble_content(); |
690 EXPECT_EQ(new_bubble_content.title, | 690 EXPECT_EQ(new_bubble_content.title, |
691 l10n_util::GetStringUTF8(IDS_MICROPHONE_CAMERA_ALLOWED)); | 691 l10n_util::GetStringUTF16(IDS_MICROPHONE_CAMERA_ALLOWED)); |
692 EXPECT_EQ(2U, new_bubble_content.radio_group.radio_items.size()); | 692 EXPECT_EQ(2U, new_bubble_content.radio_group.radio_items.size()); |
693 EXPECT_EQ(new_bubble_content.radio_group.radio_items[0], | 693 EXPECT_EQ(new_bubble_content.radio_group.radio_items[0], |
694 l10n_util::GetStringFUTF8( | 694 l10n_util::GetStringFUTF8( |
695 IDS_ALLOWED_MEDIASTREAM_MIC_AND_CAMERA_NO_ACTION, | 695 IDS_ALLOWED_MEDIASTREAM_MIC_AND_CAMERA_NO_ACTION, |
696 url_formatter::FormatUrlForSecurityDisplay(security_origin))); | 696 url_formatter::FormatUrlForSecurityDisplay(security_origin))); |
697 EXPECT_EQ(new_bubble_content.radio_group.radio_items[1], | 697 EXPECT_EQ(new_bubble_content.radio_group.radio_items[1], |
698 l10n_util::GetStringUTF8( | 698 l10n_util::GetStringUTF8( |
699 IDS_ALLOWED_MEDIASTREAM_MIC_AND_CAMERA_BLOCK)); | 699 IDS_ALLOWED_MEDIASTREAM_MIC_AND_CAMERA_BLOCK)); |
700 EXPECT_EQ(0, new_bubble_content.radio_group.default_item); | 700 EXPECT_EQ(0, new_bubble_content.radio_group.default_item); |
701 EXPECT_EQ(2U, new_bubble_content.media_menus.size()); | 701 EXPECT_EQ(2U, new_bubble_content.media_menus.size()); |
(...skipping 27 matching lines...) Expand all Loading... |
729 TabSpecificContentSettings* content_settings = | 729 TabSpecificContentSettings* content_settings = |
730 TabSpecificContentSettings::FromWebContents(web_contents()); | 730 TabSpecificContentSettings::FromWebContents(web_contents()); |
731 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_PPAPI_BROKER); | 731 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_PPAPI_BROKER); |
732 | 732 |
733 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 733 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
734 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 734 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
735 NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_PPAPI_BROKER)); | 735 NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_PPAPI_BROKER)); |
736 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 736 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
737 content_setting_bubble_model->bubble_content(); | 737 content_setting_bubble_model->bubble_content(); |
738 | 738 |
739 std::string title = bubble_content.title; | 739 base::string16 title = bubble_content.title; |
740 EXPECT_FALSE(title.empty()); | 740 EXPECT_FALSE(title.empty()); |
741 ASSERT_EQ(2U, bubble_content.radio_group.radio_items.size()); | 741 ASSERT_EQ(2U, bubble_content.radio_group.radio_items.size()); |
742 std::string radio1 = bubble_content.radio_group.radio_items[0]; | 742 std::string radio1 = bubble_content.radio_group.radio_items[0]; |
743 std::string radio2 = bubble_content.radio_group.radio_items[1]; | 743 std::string radio2 = bubble_content.radio_group.radio_items[1]; |
744 EXPECT_FALSE(bubble_content.custom_link_enabled); | 744 EXPECT_FALSE(bubble_content.custom_link_enabled); |
745 EXPECT_FALSE(bubble_content.manage_link.empty()); | 745 EXPECT_FALSE(bubble_content.manage_link.empty()); |
746 | 746 |
747 content_settings->ClearBlockedContentSettingsExceptForCookies(); | 747 content_settings->ClearBlockedContentSettingsExceptForCookies(); |
748 content_settings->OnContentAllowed(CONTENT_SETTINGS_TYPE_PPAPI_BROKER); | 748 content_settings->OnContentAllowed(CONTENT_SETTINGS_TYPE_PPAPI_BROKER); |
749 content_setting_bubble_model.reset( | 749 content_setting_bubble_model.reset( |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 | 919 |
920 registry.Shutdown(); | 920 registry.Shutdown(); |
921 } | 921 } |
922 | 922 |
923 TEST_F(ContentSettingBubbleModelTest, SubresourceFilter) { | 923 TEST_F(ContentSettingBubbleModelTest, SubresourceFilter) { |
924 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 924 std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
925 new ContentSettingSubresourceFilterBubbleModel(nullptr, web_contents(), | 925 new ContentSettingSubresourceFilterBubbleModel(nullptr, web_contents(), |
926 profile())); | 926 profile())); |
927 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 927 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
928 content_setting_bubble_model->bubble_content(); | 928 content_setting_bubble_model->bubble_content(); |
929 EXPECT_EQ(bubble_content.title, | 929 EXPECT_EQ( |
930 l10n_util::GetStringUTF8( | 930 bubble_content.title, |
| 931 l10n_util::GetStringUTF16(IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_TITLE)); |
| 932 EXPECT_EQ(bubble_content.message, |
| 933 l10n_util::GetStringUTF16( |
931 IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_EXPLANATION)); | 934 IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_EXPLANATION)); |
932 EXPECT_EQ(0U, bubble_content.radio_group.radio_items.size()); | 935 EXPECT_EQ(0U, bubble_content.radio_group.radio_items.size()); |
933 EXPECT_EQ(0, bubble_content.radio_group.default_item); | 936 EXPECT_EQ(0, bubble_content.radio_group.default_item); |
934 EXPECT_TRUE(bubble_content.custom_link.empty()); | 937 EXPECT_TRUE(bubble_content.custom_link.empty()); |
935 EXPECT_FALSE(bubble_content.custom_link_enabled); | 938 EXPECT_FALSE(bubble_content.custom_link_enabled); |
936 EXPECT_EQ( | 939 EXPECT_EQ( |
937 bubble_content.manage_link, | 940 bubble_content.manage_link, |
938 l10n_util::GetStringUTF8(IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_RELOAD)); | 941 l10n_util::GetStringUTF8(IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_RELOAD)); |
939 EXPECT_EQ(0U, bubble_content.media_menus.size()); | 942 EXPECT_EQ(0U, bubble_content.media_menus.size()); |
940 } | 943 } |
OLD | NEW |