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

Unified Diff: chrome/browser/ui/browser_browsertest.cc

Issue 2629383002: Add functionality to get default media device IDs from user preferences. (Closed)
Patch Set: address pkasting@'s comments Created 3 years, 11 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.cc ('k') | content/public/browser/web_contents_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_browsertest.cc
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc
index cbe4be59970a3b4bb78d4626c68cacf7415ebb77..706b88bf61bbcb68a08b91b5b4e37ef225a6c223 100644
--- a/chrome/browser/ui/browser_browsertest.cc
+++ b/chrome/browser/ui/browser_browsertest.cc
@@ -2755,6 +2755,37 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CanDuplicateTab) {
EXPECT_TRUE(chrome::CanDuplicateTabAt(browser(), 1));
}
+IN_PROC_BROWSER_TEST_F(BrowserTest, DefaultMediaDevices) {
+ const std::string kDefaultAudioCapture1 = "test_default_audio_capture";
+ const std::string kDefaultVideoCapture1 = "test_default_video_capture";
+ auto SetString = [this](const std::string& path, const std::string& value) {
+ browser()->profile()->GetPrefs()->SetString(path, value);
+ };
+ SetString(prefs::kDefaultAudioCaptureDevice, kDefaultAudioCapture1);
+ SetString(prefs::kDefaultVideoCaptureDevice, kDefaultVideoCapture1);
+
+ ui_test_utils::NavigateToURL(browser(), GURL("chrome://newtab"));
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ auto GetDeviceID = [web_contents](content::MediaStreamType type) {
+ return web_contents->GetDelegate()->GetDefaultMediaDeviceID(web_contents,
+ type);
+ };
+ EXPECT_EQ(kDefaultAudioCapture1,
+ GetDeviceID(content::MEDIA_DEVICE_AUDIO_CAPTURE));
+ EXPECT_EQ(kDefaultVideoCapture1,
+ GetDeviceID(content::MEDIA_DEVICE_VIDEO_CAPTURE));
+
+ const std::string kDefaultAudioCapture2 = "test_default_audio_capture_2";
+ const std::string kDefaultVideoCapture2 = "test_default_video_capture_2";
+ SetString(prefs::kDefaultAudioCaptureDevice, kDefaultAudioCapture2);
+ SetString(prefs::kDefaultVideoCaptureDevice, kDefaultVideoCapture2);
+ EXPECT_EQ(kDefaultAudioCapture2,
+ GetDeviceID(content::MEDIA_DEVICE_AUDIO_CAPTURE));
+ EXPECT_EQ(kDefaultVideoCapture2,
+ GetDeviceID(content::MEDIA_DEVICE_VIDEO_CAPTURE));
+}
+
namespace {
class JSBooleanResultGetter {
public:
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | content/public/browser/web_contents_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698