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

Unified Diff: chrome/browser/ui/content_settings/content_setting_bubble_model_browsertest.cc

Issue 1273683002: Fix a forgotten return statement in BrowserContentSettingBubbleModelDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Browsertest Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/browser_content_setting_bubble_model_delegate.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 238b3806240194b38e4b46f162b8a3d95603df14..c55866c1beaeeaf8892890e0709e36f3a41918b9 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
@@ -98,3 +98,69 @@ IN_PROC_BROWSER_TEST_F(ContentSettingBubbleModelMixedScriptTest, Iframe) {
EXPECT_FALSE(GetActiveTabSpecificContentSettings()->IsContentBlocked(
CONTENT_SETTINGS_TYPE_MIXEDSCRIPT));
}
+
+class ContentSettingBubbleModelMediaStreamTest : public InProcessBrowserTest {
+ public:
+ scoped_ptr<ContentSettingBubbleModel> GetNewBubbleInTheFirstTab() {
msw 2015/08/05 17:05:38 nit: rename this CreateBubble(), or better yet com
msramek 2015/08/05 17:39:28 Yep, that sounds good.
+ return make_scoped_ptr(
+ ContentSettingBubbleModel::CreateContentSettingBubbleModel(
+ browser()->content_setting_bubble_model_delegate(),
+ GetFirstTab(),
+ browser()->profile(),
+ CONTENT_SETTINGS_TYPE_MEDIASTREAM));
+ }
+
+ void SetAccessedDevices(
+ TabSpecificContentSettings::MicrophoneCameraState state) {
+ TabSpecificContentSettings::FromWebContents(GetFirstTab())->
+ OnMediaStreamPermissionSet(
+ GetFirstTab()->GetLastCommittedURL(),
+ state, device_name_, device_name_, device_name_, device_name_);
+ }
+
+ void WaitForNavigation() {
+ content::TestNavigationObserver observer(
+ browser()->tab_strip_model()->GetActiveWebContents());
msw 2015/08/05 17:05:38 nit: use GetFirstTab() here?
msramek 2015/08/05 17:39:28 No actually. The bubble itself is invoked for the
msw 2015/08/05 17:47:20 Acknowledged.
+ observer.Wait();
+ }
+
+ private:
+ content::WebContents* GetFirstTab() {
+ return browser()->tab_strip_model()->GetWebContentsAt(0);
+ }
+
+ std::string device_name_ = "is not important for this test";
msw 2015/08/05 17:05:38 nit: can you remove this and just pass std::string
msramek 2015/08/05 17:39:28 Done.
+};
+
+// Tests that clicking on the management link in the media bubble opens
+// the correct section of the settings UI.
+IN_PROC_BROWSER_TEST_F(ContentSettingBubbleModelMediaStreamTest, ManageLink) {
+ // The microphone bubble links to microphone exceptions.
+ SetAccessedDevices(TabSpecificContentSettings::MICROPHONE_ACCESSED);
+ scoped_ptr<ContentSettingBubbleModel> bubble = GetNewBubbleInTheFirstTab();
+ bubble->OnManageLinkClicked();
+ WaitForNavigation();
+ EXPECT_EQ(GURL("chrome://settings/contentExceptions#media-stream-mic"),
+ browser()->tab_strip_model()->
+ GetActiveWebContents()->GetLastCommittedURL());
+
+ // The camera bubble links to camera exceptions.
+ SetAccessedDevices(TabSpecificContentSettings::CAMERA_ACCESSED);
+ bubble = GetNewBubbleInTheFirstTab();
+ bubble->OnManageLinkClicked();
+ WaitForNavigation();
+ EXPECT_EQ(GURL("chrome://settings/contentExceptions#media-stream-camera"),
+ browser()->tab_strip_model()->
+ GetActiveWebContents()->GetLastCommittedURL());
+
+ // The bubble for both media devices links to the the first section of the
+ // default media content settings, which is the microphone section.
+ SetAccessedDevices(TabSpecificContentSettings::MICROPHONE_ACCESSED |
+ TabSpecificContentSettings::CAMERA_ACCESSED);
+ bubble = GetNewBubbleInTheFirstTab();
+ bubble->OnManageLinkClicked();
+ WaitForNavigation();
+ EXPECT_EQ(GURL("chrome://settings/content#media-stream-mic"),
+ browser()->tab_strip_model()->
+ GetActiveWebContents()->GetLastCommittedURL());
+}
« no previous file with comments | « chrome/browser/ui/browser_content_setting_bubble_model_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698