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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chrome/browser/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 2737 matching lines...) Expand 10 before | Expand all | Expand 10 after
2748 // destroy |contents|. 2748 // destroy |contents|.
2749 interstitial->DontProceed(); 2749 interstitial->DontProceed();
2750 content::WaitForInterstitialDetach(web_contents); 2750 content::WaitForInterstitialDetach(web_contents);
2751 // interstitial is deleted now. 2751 // interstitial is deleted now.
2752 2752
2753 EXPECT_TRUE(chrome::CanDuplicateTab(browser())); 2753 EXPECT_TRUE(chrome::CanDuplicateTab(browser()));
2754 EXPECT_TRUE(chrome::CanDuplicateTabAt(browser(), 0)); 2754 EXPECT_TRUE(chrome::CanDuplicateTabAt(browser(), 0));
2755 EXPECT_TRUE(chrome::CanDuplicateTabAt(browser(), 1)); 2755 EXPECT_TRUE(chrome::CanDuplicateTabAt(browser(), 1));
2756 } 2756 }
2757 2757
2758 IN_PROC_BROWSER_TEST_F(BrowserTest, DefaultMediaDevices) {
2759 const std::string kDefaultAudioCapture1 = "test_default_audio_capture";
2760 const std::string kDefaultVideoCapture1 = "test_default_video_capture";
2761 auto SetString = [this](const std::string& path, const std::string& value) {
2762 browser()->profile()->GetPrefs()->SetString(path, value);
2763 };
2764 SetString(prefs::kDefaultAudioCaptureDevice, kDefaultAudioCapture1);
2765 SetString(prefs::kDefaultVideoCaptureDevice, kDefaultVideoCapture1);
2766
2767 ui_test_utils::NavigateToURL(browser(), GURL("chrome://newtab"));
2768 WebContents* web_contents =
2769 browser()->tab_strip_model()->GetActiveWebContents();
2770 auto GetDeviceID = [web_contents](content::MediaStreamType type) {
2771 return web_contents->GetDelegate()->GetDefaultMediaDeviceID(web_contents,
2772 type);
2773 };
2774 EXPECT_EQ(kDefaultAudioCapture1,
2775 GetDeviceID(content::MEDIA_DEVICE_AUDIO_CAPTURE));
2776 EXPECT_EQ(kDefaultVideoCapture1,
2777 GetDeviceID(content::MEDIA_DEVICE_VIDEO_CAPTURE));
2778
2779 const std::string kDefaultAudioCapture2 = "test_default_audio_capture_2";
2780 const std::string kDefaultVideoCapture2 = "test_default_video_capture_2";
2781 SetString(prefs::kDefaultAudioCaptureDevice, kDefaultAudioCapture2);
2782 SetString(prefs::kDefaultVideoCaptureDevice, kDefaultVideoCapture2);
2783 EXPECT_EQ(kDefaultAudioCapture2,
2784 GetDeviceID(content::MEDIA_DEVICE_AUDIO_CAPTURE));
2785 EXPECT_EQ(kDefaultVideoCapture2,
2786 GetDeviceID(content::MEDIA_DEVICE_VIDEO_CAPTURE));
2787 }
2788
2758 namespace { 2789 namespace {
2759 class JSBooleanResultGetter { 2790 class JSBooleanResultGetter {
2760 public: 2791 public:
2761 JSBooleanResultGetter() = default; 2792 JSBooleanResultGetter() = default;
2762 void OnJsExecutionDone(base::Closure callback, const base::Value* value) { 2793 void OnJsExecutionDone(base::Closure callback, const base::Value* value) {
2763 js_result_.reset(value->DeepCopy()); 2794 js_result_.reset(value->DeepCopy());
2764 callback.Run(); 2795 callback.Run();
2765 } 2796 }
2766 bool GetResult() const { 2797 bool GetResult() const {
2767 bool res; 2798 bool res;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
2902 Browser* browser = new Browser(params); 2933 Browser* browser = new Browser(params);
2903 gfx::Rect bounds = browser->window()->GetBounds(); 2934 gfx::Rect bounds = browser->window()->GetBounds();
2904 2935
2905 // Should be EXPECT_EQ, but this width is inconsistent across platforms. 2936 // Should be EXPECT_EQ, but this width is inconsistent across platforms.
2906 // See https://crbug.com/567925. 2937 // See https://crbug.com/567925.
2907 EXPECT_GE(bounds.width(), 100); 2938 EXPECT_GE(bounds.width(), 100);
2908 EXPECT_EQ(122, bounds.height()); 2939 EXPECT_EQ(122, bounds.height());
2909 browser->window()->Close(); 2940 browser->window()->Close();
2910 } 2941 }
2911 } 2942 }
OLDNEW
« 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