| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/permissions/permission_request_manager.h" | 5 #include "chrome/browser/permissions/permission_request_manager.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" | 10 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "components/content_settings/core/common/content_settings_types.h" | 24 #include "components/content_settings/core/common/content_settings_types.h" |
| 25 #include "components/variations/variations_associated_data.h" | 25 #include "components/variations/variations_associated_data.h" |
| 26 #include "content/public/browser/render_frame_host.h" | 26 #include "content/public/browser/render_frame_host.h" |
| 27 #include "content/public/browser/render_process_host.h" | 27 #include "content/public/browser/render_process_host.h" |
| 28 #include "content/public/test/browser_test_utils.h" | 28 #include "content/public/test/browser_test_utils.h" |
| 29 #include "content/public/test/test_utils.h" | 29 #include "content/public/test/test_utils.h" |
| 30 #include "net/test/embedded_test_server/embedded_test_server.h" | 30 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 31 | 31 |
| 32 namespace test { | 32 namespace test { |
| 33 class MediaStreamDevicesControllerTestApi | 33 class MediaStreamDevicesControllerTestApi |
| 34 : public internal::PermissionPromptDelegate { | 34 : public MediaStreamDevicesController::PermissionPromptDelegate { |
| 35 public: | 35 public: |
| 36 static void AddRequestToManager( | 36 static void AddRequestToManager( |
| 37 PermissionRequestManager* manager, | 37 PermissionRequestManager* manager, |
| 38 content::WebContents* web_contents, | 38 content::WebContents* web_contents, |
| 39 const content::MediaStreamRequest& request, | 39 const content::MediaStreamRequest& request, |
| 40 const content::MediaResponseCallback& callback) { | 40 const content::MediaResponseCallback& callback) { |
| 41 MediaStreamDevicesControllerTestApi delegate(manager); | 41 MediaStreamDevicesControllerTestApi delegate(manager); |
| 42 MediaStreamDevicesController::RequestPermissionsWithDelegate( | 42 MediaStreamDevicesController::RequestPermissionsWithDelegate( |
| 43 request, callback, &delegate); | 43 request, callback, &delegate); |
| 44 } | 44 } |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 // MediaStreamDevicesController::PermissionPromptDelegate: | 47 // MediaStreamDevicesController::PermissionPromptDelegate: |
| 48 void ShowPrompt( | 48 void ShowPrompt( |
| 49 bool user_gesture, | 49 bool user_gesture, |
| 50 content::WebContents* web_contents, | 50 content::WebContents* web_contents, |
| 51 std::unique_ptr<MediaStreamDevicesController> controller) override { | 51 std::unique_ptr<MediaStreamDevicesController::Request> request) override { |
| 52 manager_->AddRequest(controller.release()); | 52 manager_->AddRequest(request.release()); |
| 53 } | 53 } |
| 54 | 54 |
| 55 explicit MediaStreamDevicesControllerTestApi( | 55 explicit MediaStreamDevicesControllerTestApi( |
| 56 PermissionRequestManager* manager) | 56 PermissionRequestManager* manager) |
| 57 : manager_(manager) {} | 57 : manager_(manager) {} |
| 58 | 58 |
| 59 PermissionRequestManager* manager_; | 59 PermissionRequestManager* manager_; |
| 60 | 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicesControllerTestApi); | 61 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicesControllerTestApi); |
| 62 }; | 62 }; |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 #define MAYBE_InvokeDialog_protected_media InvokeDialog_protected_media | 496 #define MAYBE_InvokeDialog_protected_media InvokeDialog_protected_media |
| 497 #else | 497 #else |
| 498 #define MAYBE_InvokeDialog_protected_media DISABLED_InvokeDialog_protected_media | 498 #define MAYBE_InvokeDialog_protected_media DISABLED_InvokeDialog_protected_media |
| 499 #endif | 499 #endif |
| 500 IN_PROC_BROWSER_TEST_F(PermissionDialogTest, | 500 IN_PROC_BROWSER_TEST_F(PermissionDialogTest, |
| 501 MAYBE_InvokeDialog_protected_media) { | 501 MAYBE_InvokeDialog_protected_media) { |
| 502 RunDialog(); | 502 RunDialog(); |
| 503 } | 503 } |
| 504 | 504 |
| 505 } // anonymous namespace | 505 } // anonymous namespace |
| OLD | NEW |