Chromium Code Reviews| 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 "base/auto_reset.h" | 5 #include "base/auto_reset.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/content_settings/host_content_settings_map.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 9 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 9 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 10 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 10 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 449 TabSpecificContentSettings::FromWebContents(web_contents()); | 449 TabSpecificContentSettings::FromWebContents(web_contents()); |
| 450 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_PLUGINS); | 450 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_PLUGINS); |
| 451 | 451 |
| 452 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 452 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
| 453 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 453 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
| 454 NULL, web_contents(), profile(), | 454 NULL, web_contents(), profile(), |
| 455 CONTENT_SETTINGS_TYPE_PLUGINS)); | 455 CONTENT_SETTINGS_TYPE_PLUGINS)); |
| 456 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 456 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
| 457 content_setting_bubble_model->bubble_content(); | 457 content_setting_bubble_model->bubble_content(); |
| 458 EXPECT_FALSE(bubble_content.title.empty()); | 458 EXPECT_FALSE(bubble_content.title.empty()); |
| 459 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); | 459 EXPECT_FALSE(bubble_content.learn_more_link.empty()); |
| 460 EXPECT_FALSE(bubble_content.custom_link.empty()); | 460 EXPECT_EQ(3U, bubble_content.radio_group.radio_items.size()); |
| 461 EXPECT_TRUE(bubble_content.custom_link_enabled); | 461 EXPECT_TRUE(bubble_content.custom_link.empty()); |
| 462 // TODO(cthomp): We no longer use custom link for plugins, so remove test? | |
| 463 // EXPECT_TRUE(bubble_content.custom_link_enabled); | |
|
Chris Thompson
2014/06/06 18:38:06
I think compilation is failing because the macro i
| |
| 462 EXPECT_FALSE(bubble_content.manage_link.empty()); | 464 EXPECT_FALSE(bubble_content.manage_link.empty()); |
| 465 | |
| 466 //Radio button tests | |
| 467 content_setting_bubble_model.OnRadioClicked(0) { | |
| 468 EXPECT_EQ(CONTENT_SETTING_ALLOW, | |
| 469 content_settings->plugin_bubble_setting()); | |
| 470 } | |
| 471 | |
| 472 content_setting_bubble_model.OnRadioClicked(1) { | |
| 473 EXPECT_EQ(CONTENT_SETTING_DEFAULT, | |
| 474 content_settings->plugin_bubble_setting()); | |
| 475 } | |
| 476 | |
| 477 content_setting_bubble_model.OnRadioClicked(2) { | |
| 478 EXPECT_EQ(CONTENT_SETTING_BLOCK, | |
| 479 content_settings->plugin_bubble_setting()); | |
| 480 } | |
| 463 } | 481 } |
| 464 | 482 |
| 465 TEST_F(ContentSettingBubbleModelTest, PepperBroker) { | 483 TEST_F(ContentSettingBubbleModelTest, PepperBroker) { |
| 466 TabSpecificContentSettings* content_settings = | 484 TabSpecificContentSettings* content_settings = |
| 467 TabSpecificContentSettings::FromWebContents(web_contents()); | 485 TabSpecificContentSettings::FromWebContents(web_contents()); |
| 468 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_PPAPI_BROKER); | 486 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_PPAPI_BROKER); |
| 469 | 487 |
| 470 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 488 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
| 471 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 489 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
| 472 NULL, web_contents(), profile(), | 490 NULL, web_contents(), profile(), |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 660 { | 678 { |
| 661 ProtocolHandler handler = registry.GetHandlerFor("mailto"); | 679 ProtocolHandler handler = registry.GetHandlerFor("mailto"); |
| 662 ASSERT_FALSE(handler.IsEmpty()); | 680 ASSERT_FALSE(handler.IsEmpty()); |
| 663 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 681 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 664 content_settings->pending_protocol_handler_setting()); | 682 content_settings->pending_protocol_handler_setting()); |
| 665 EXPECT_FALSE(registry.IsIgnored(test_handler)); | 683 EXPECT_FALSE(registry.IsIgnored(test_handler)); |
| 666 } | 684 } |
| 667 | 685 |
| 668 registry.Shutdown(); | 686 registry.Shutdown(); |
| 669 } | 687 } |
| OLD | NEW |