Chromium Code Reviews| Index: chrome/browser/ui/content_settings/content_setting_bubble_model_browsertest.cc |
| diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model_browsertest.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model_browsertest.cc |
| index 84cf40e08028954cf3c5870a7de4f2d755f1536b..39960d45d5f3fc326ad889e918b1d503cdd06399 100644 |
| --- a/chrome/browser/ui/content_settings/content_setting_bubble_model_browsertest.cc |
| +++ b/chrome/browser/ui/content_settings/content_setting_bubble_model_browsertest.cc |
| @@ -228,3 +228,58 @@ IN_PROC_BROWSER_TEST_F(ContentSettingBubbleModelMediaStreamTest, |
| EXPECT_EQ(GURL("chrome://settings/contentExceptions#media-stream-camera"), |
| GetActiveTab()->GetLastCommittedURL()); |
| } |
| + |
| +#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_WIN) |
|
dominickn
2016/12/20 05:31:48
Is there a reason for this guard? It only excludes
charleszhao
2016/12/20 22:43:50
Thanks, I was thinking to prevent the test running
|
| +class ContentSettingBubbleModelPopupTest : public InProcessBrowserTest { |
| + protected: |
| + void SetUpInProcessBrowserTestFixture() override { |
| + https_server_.reset( |
| + new net::EmbeddedTestServer(net::EmbeddedTestServer::TYPE_HTTPS)); |
| + https_server_->ServeFilesFromSourceDirectory(base::FilePath(kDocRoot)); |
| + ASSERT_TRUE(https_server_->Start()); |
| + } |
| + std::unique_ptr<net::EmbeddedTestServer> https_server_; |
| +}; |
| + |
| +IN_PROC_BROWSER_TEST_F(ContentSettingBubbleModelPopupTest, |
| + PopupsActionsCount){ |
| + GURL url(https_server_->GetURL("/popup_blocker/popup-many.html")); |
| + base::HistogramTester histograms; |
| + histograms.ExpectTotalCount("ContentSettings.Popups", 0); |
| + |
| + ui_test_utils::NavigateToURL(browser(), url); |
| + |
| + histograms.ExpectBucketCount( |
| + "ContentSettings.Popups", |
| + content_settings::POPUPS_ACTION_DISPLAYED_BLOCKED_ICON_IN_OMNIBOX, 1); |
| + |
| + // Creates the ContentSettingPopupBubbleModel in order to emulate clicks. |
| + std::unique_ptr<ContentSettingBubbleModel> model( |
| + ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
| + browser()->content_setting_bubble_model_delegate(), |
| + browser()->tab_strip_model()->GetActiveWebContents(), |
| + browser()->profile(), CONTENT_SETTINGS_TYPE_POPUPS)); |
| + |
| + histograms.ExpectBucketCount( |
| + "ContentSettings.Popups", |
| + content_settings::POPUPS_ACTION_DISPLAYED_BUBBLE, 1); |
| + |
| + model->OnListItemClicked(0); |
| + histograms.ExpectBucketCount( |
| + "ContentSettings.Popups", |
| + content_settings::POPUPS_ACTION_CLICKED_LIST_ITEM_CLICKED, 1); |
| + |
| + model->OnManageLinkClicked(); |
| + histograms.ExpectBucketCount( |
| + "ContentSettings.Popups", |
| + content_settings::POPUPS_ACTION_CLICKED_MANAGE_POPUPS_BLOCKING, 1); |
| + |
| + model->OnRadioClicked(model->kAllowButtonIndex); |
| + delete model.release(); |
| + histograms.ExpectBucketCount( |
| + "ContentSettings.Popups", |
| + content_settings::POPUPS_ACTION_SELECTED_ALWAYS_ALLOW_POPUPS_FROM, 1); |
| + |
| + histograms.ExpectTotalCount("ContentSettings.Popups", 5); |
| +} |
| +#endif |