OLD | NEW |
---|---|
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 Loading... | |
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 std::string default_audio_capture_1("test_default_audio_capture"); | |
Peter Kasting
2017/01/24 00:39:17
Nit: Prefer = to () for initializing strings; see
Guido Urdaneta
2017/01/24 09:31:35
Done.
| |
2760 std::string default_video_capture_1("test_default_video_capture"); | |
2761 browser()->profile()->GetPrefs()->SetString(prefs::kDefaultAudioCaptureDevice, | |
2762 default_audio_capture_1); | |
2763 browser()->profile()->GetPrefs()->SetString(prefs::kDefaultVideoCaptureDevice, | |
2764 default_video_capture_1); | |
Peter Kasting
2017/01/24 00:39:17
Nit: Optional, but if you use a lambda here, you c
Guido Urdaneta
2017/01/24 09:31:35
Done.
| |
2765 ui_test_utils::NavigateToURL(browser(), GURL("chrome://newtab")); | |
2766 WebContents* web_contents = | |
2767 browser()->tab_strip_model()->GetActiveWebContents(); | |
2768 EXPECT_EQ(default_audio_capture_1, | |
2769 web_contents->GetDelegate()->GetDefaultMediaDeviceID( | |
2770 web_contents, content::MEDIA_DEVICE_AUDIO_CAPTURE)); | |
Peter Kasting
2017/01/24 00:39:17
Nit: Optional, but if you use a lambda here, you c
Guido Urdaneta
2017/01/24 09:31:35
Done.
| |
2771 EXPECT_EQ(default_video_capture_1, | |
2772 web_contents->GetDelegate()->GetDefaultMediaDeviceID( | |
2773 web_contents, content::MEDIA_DEVICE_VIDEO_CAPTURE)); | |
2774 | |
2775 std::string default_audio_capture_2("test_default_audio_capture_2"); | |
2776 std::string default_video_capture_2("test_default_video_capture_2"); | |
2777 browser()->profile()->GetPrefs()->SetString(prefs::kDefaultAudioCaptureDevice, | |
2778 default_audio_capture_2); | |
2779 browser()->profile()->GetPrefs()->SetString(prefs::kDefaultVideoCaptureDevice, | |
2780 default_video_capture_2); | |
2781 EXPECT_EQ(default_audio_capture_2, | |
2782 web_contents->GetDelegate()->GetDefaultMediaDeviceID( | |
2783 web_contents, content::MEDIA_DEVICE_AUDIO_CAPTURE)); | |
2784 EXPECT_EQ(default_video_capture_2, | |
2785 web_contents->GetDelegate()->GetDefaultMediaDeviceID( | |
2786 web_contents, 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 Loading... | |
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 } |
OLD | NEW |