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

Side by Side Diff: chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc

Issue 319553008: Updated Plugin bubble model to add "learn more" link and to appear with a sliding yellow thing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed typos Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/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
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?
felt 2014/06/11 02:37:30 Another TODO here, can you delete the commented ou
radhikabhar 2014/06/11 17:31:46 Done.
463 // EXPECT_TRUE(bubble_content.custom_link_enabled);
462 EXPECT_FALSE(bubble_content.manage_link.empty()); 464 EXPECT_FALSE(bubble_content.manage_link.empty());
465
466 //Test to see that the default radio item is set to Block
felt 2014/06/11 02:37:30 Missing a space: // Test to ...
radhikabhar 2014/06/11 17:31:46 Done.
467 EXPECT_EQ(2, bubble_content.radio_group.default_item);
468 }
469
470 TEST_F(ContentSettingBubbleModelTest, BlockedPluginsPermissionChange) {
471 TabSpecificContentSettings* content_settings =
472 TabSpecificContentSettings::FromWebContents(web_contents());
felt 2014/06/11 02:37:30 indent line 472 by 4 more spaces
radhikabhar 2014/06/11 17:31:46 Done.
473 std::string file_url("file:///plugin/quicktime.html");
474 NavigateAndCommit(GURL(file_url));
475 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_PLUGINS);
476 {
477 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
478 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
479 NULL, web_contents(), profile(),
480 CONTENT_SETTINGS_TYPE_PLUGINS));
481 }
482
483 EXPECT_EQ(CONTENT_SETTING_BLOCK,
484 content_settings->plugin_bubble_setting());
485
486 {
487 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
488 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
489 NULL, web_contents(), profile(),
490 CONTENT_SETTINGS_TYPE_PLUGINS));
491 // Change the radio setting
492 content_setting_bubble_model->OnRadioClicked(0);
493 }
494
495 EXPECT_EQ(CONTENT_SETTING_ALLOW,
496 content_settings->plugin_bubble_setting());
497
498 {
499 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
500 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
501 NULL, web_contents(), profile(),
502 CONTENT_SETTINGS_TYPE_PLUGINS));
503 // Change the radio setting
504 content_setting_bubble_model->OnRadioClicked(1);
505 }
506
507 EXPECT_EQ(CONTENT_SETTING_DEFAULT,
508 content_settings->plugin_bubble_setting());
463 } 509 }
464 510
465 TEST_F(ContentSettingBubbleModelTest, PepperBroker) { 511 TEST_F(ContentSettingBubbleModelTest, PepperBroker) {
466 TabSpecificContentSettings* content_settings = 512 TabSpecificContentSettings* content_settings =
467 TabSpecificContentSettings::FromWebContents(web_contents()); 513 TabSpecificContentSettings::FromWebContents(web_contents());
468 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_PPAPI_BROKER); 514 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_PPAPI_BROKER);
469 515
470 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( 516 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
471 ContentSettingBubbleModel::CreateContentSettingBubbleModel( 517 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
472 NULL, web_contents(), profile(), 518 NULL, web_contents(), profile(),
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 { 706 {
661 ProtocolHandler handler = registry.GetHandlerFor("mailto"); 707 ProtocolHandler handler = registry.GetHandlerFor("mailto");
662 ASSERT_FALSE(handler.IsEmpty()); 708 ASSERT_FALSE(handler.IsEmpty());
663 EXPECT_EQ(CONTENT_SETTING_ALLOW, 709 EXPECT_EQ(CONTENT_SETTING_ALLOW,
664 content_settings->pending_protocol_handler_setting()); 710 content_settings->pending_protocol_handler_setting());
665 EXPECT_FALSE(registry.IsIgnored(test_handler)); 711 EXPECT_FALSE(registry.IsIgnored(test_handler));
666 } 712 }
667 713
668 registry.Shutdown(); 714 registry.Shutdown();
669 } 715 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698