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 "base/test/scoped_feature_list.h" | 9 #include "base/test/scoped_feature_list.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 const char* kPermissionsKillSwitchBlockedValue = | 71 const char* kPermissionsKillSwitchBlockedValue = |
72 PermissionContextBase::kPermissionsKillSwitchBlockedValue; | 72 PermissionContextBase::kPermissionsKillSwitchBlockedValue; |
73 const char kPermissionsKillSwitchTestGroup[] = "TestGroup"; | 73 const char kPermissionsKillSwitchTestGroup[] = "TestGroup"; |
74 | 74 |
75 class PermissionRequestManagerBrowserTest : public InProcessBrowserTest { | 75 class PermissionRequestManagerBrowserTest : public InProcessBrowserTest { |
76 public: | 76 public: |
77 PermissionRequestManagerBrowserTest() = default; | 77 PermissionRequestManagerBrowserTest() = default; |
78 ~PermissionRequestManagerBrowserTest() override = default; | 78 ~PermissionRequestManagerBrowserTest() override = default; |
79 | 79 |
80 void SetUpOnMainThread() override { | 80 void SetUpOnMainThread() override { |
81 InProcessBrowserTest::SetUpOnMainThread(); | |
82 PermissionRequestManager* manager = GetPermissionRequestManager(); | 81 PermissionRequestManager* manager = GetPermissionRequestManager(); |
83 mock_permission_prompt_factory_.reset( | 82 mock_permission_prompt_factory_.reset( |
84 new MockPermissionPromptFactory(manager)); | 83 new MockPermissionPromptFactory(manager)); |
85 manager->DisplayPendingRequests(); | 84 manager->DisplayPendingRequests(); |
86 } | 85 } |
87 | 86 |
88 void TearDownOnMainThread() override { | 87 void TearDownOnMainThread() override { |
89 mock_permission_prompt_factory_.reset(); | 88 mock_permission_prompt_factory_.reset(); |
90 InProcessBrowserTest::TearDownOnMainThread(); | 89 InProcessBrowserTest::TearDownOnMainThread(); |
91 } | 90 } |
(...skipping 28 matching lines...) Expand all Loading... |
120 // Uses a "real" PermissionPromptFactory rather than a mock. | 119 // Uses a "real" PermissionPromptFactory rather than a mock. |
121 class PermissionDialogTest | 120 class PermissionDialogTest |
122 : public SupportsTestDialog<PermissionRequestManagerBrowserTest> { | 121 : public SupportsTestDialog<PermissionRequestManagerBrowserTest> { |
123 public: | 122 public: |
124 PermissionDialogTest() {} | 123 PermissionDialogTest() {} |
125 | 124 |
126 // InProcessBrowserTest: | 125 // InProcessBrowserTest: |
127 void SetUpOnMainThread() override { | 126 void SetUpOnMainThread() override { |
128 // Skip super: It will install a mock permission UI factory, but for this | 127 // Skip super: It will install a mock permission UI factory, but for this |
129 // test we want to show "real" UI. | 128 // test we want to show "real" UI. |
130 InProcessBrowserTest::SetUpOnMainThread(); | |
131 ui_test_utils::NavigateToURL(browser(), GetUrl()); | 129 ui_test_utils::NavigateToURL(browser(), GetUrl()); |
132 } | 130 } |
133 | 131 |
134 private: | 132 private: |
135 GURL GetUrl() { return GURL("https://example.com"); } | 133 GURL GetUrl() { return GURL("https://example.com"); } |
136 | 134 |
137 PermissionRequest* MakeRegisterProtocolHandlerRequest(); | 135 PermissionRequest* MakeRegisterProtocolHandlerRequest(); |
138 void AddMediaRequest(PermissionRequestManager* manager, | 136 void AddMediaRequest(PermissionRequestManager* manager, |
139 ContentSettingsType permission); | 137 ContentSettingsType permission); |
140 PermissionRequest* MakePermissionRequest(ContentSettingsType permission); | 138 PermissionRequest* MakePermissionRequest(ContentSettingsType permission); |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 #define MAYBE_InvokeDialog_protected_media InvokeDialog_protected_media | 515 #define MAYBE_InvokeDialog_protected_media InvokeDialog_protected_media |
518 #else | 516 #else |
519 #define MAYBE_InvokeDialog_protected_media DISABLED_InvokeDialog_protected_media | 517 #define MAYBE_InvokeDialog_protected_media DISABLED_InvokeDialog_protected_media |
520 #endif | 518 #endif |
521 IN_PROC_BROWSER_TEST_F(PermissionDialogTest, | 519 IN_PROC_BROWSER_TEST_F(PermissionDialogTest, |
522 MAYBE_InvokeDialog_protected_media) { | 520 MAYBE_InvokeDialog_protected_media) { |
523 RunDialog(); | 521 RunDialog(); |
524 } | 522 } |
525 | 523 |
526 } // anonymous namespace | 524 } // anonymous namespace |
OLD | NEW |