| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "android_webview/native/permission/media_access_permission_request.h" | 5 #include "android_webview/native/permission/media_access_permission_request.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 namespace android_webview { | 9 namespace android_webview { |
| 10 | 10 |
| 11 class TestMediaAccessPermissionRequest : public MediaAccessPermissionRequest { | 11 class TestMediaAccessPermissionRequest : public MediaAccessPermissionRequest { |
| 12 public: | 12 public: |
| 13 TestMediaAccessPermissionRequest( | 13 TestMediaAccessPermissionRequest( |
| 14 const content::MediaStreamRequest& request, | 14 const content::MediaStreamRequest& request, |
| 15 const content::MediaResponseCallback& callback, | 15 const content::MediaResponseCallback& callback, |
| 16 const content::MediaStreamDevices& audio_devices, | 16 const content::MediaStreamDevices& audio_devices, |
| 17 const content::MediaStreamDevices& video_devices) | 17 const content::MediaStreamDevices& video_devices) |
| 18 : MediaAccessPermissionRequest(request, callback) { | 18 : MediaAccessPermissionRequest(request, callback) { |
| 19 audio_test_devices_ = audio_devices; | 19 audio_test_devices_ = audio_devices; |
| 20 video_test_devices_ = video_devices; | 20 video_test_devices_ = video_devices; |
| 21 } | 21 } |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 class MediaAccessPermissionRequestTest : public testing::Test { | 24 class MediaAccessPermissionRequestTest : public testing::Test { |
| 25 protected: | 25 protected: |
| 26 virtual void SetUp() { | 26 void SetUp() override { |
| 27 audio_device_id_ = "audio"; | 27 audio_device_id_ = "audio"; |
| 28 video_device_id_ = "video"; | 28 video_device_id_ = "video"; |
| 29 first_audio_device_id_ = "audio1"; | 29 first_audio_device_id_ = "audio1"; |
| 30 first_video_device_id_ = "video1"; | 30 first_video_device_id_ = "video1"; |
| 31 } | 31 } |
| 32 | 32 |
| 33 scoped_ptr<TestMediaAccessPermissionRequest> CreateRequest( | 33 scoped_ptr<TestMediaAccessPermissionRequest> CreateRequest( |
| 34 std::string audio_id, | 34 std::string audio_id, |
| 35 std::string video_id) { | 35 std::string video_id) { |
| 36 content::MediaStreamDevices audio_devices; | 36 content::MediaStreamDevices audio_devices; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 130 |
| 131 TEST_F(MediaAccessPermissionRequestTest, TestDenyPermissionRequest) { | 131 TEST_F(MediaAccessPermissionRequestTest, TestDenyPermissionRequest) { |
| 132 scoped_ptr<TestMediaAccessPermissionRequest> request = | 132 scoped_ptr<TestMediaAccessPermissionRequest> request = |
| 133 CreateRequest(std::string(), std::string()); | 133 CreateRequest(std::string(), std::string()); |
| 134 request->NotifyRequestResult(false); | 134 request->NotifyRequestResult(false); |
| 135 EXPECT_TRUE(devices_.empty()); | 135 EXPECT_TRUE(devices_.empty()); |
| 136 EXPECT_EQ(content::MEDIA_DEVICE_PERMISSION_DENIED, result_); | 136 EXPECT_EQ(content::MEDIA_DEVICE_PERMISSION_DENIED, result_); |
| 137 } | 137 } |
| 138 | 138 |
| 139 } // namespace android_webview | 139 } // namespace android_webview |
| OLD | NEW |