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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 .Build(); | 110 .Build(); |
111 | 111 |
112 content::TestWebContentsFactory factory; | 112 content::TestWebContentsFactory factory; |
113 ExtensionInstallPrompt prompt(factory.CreateWebContents(profile())); | 113 ExtensionInstallPrompt prompt(factory.CreateWebContents(profile())); |
114 base::RunLoop run_loop; | 114 base::RunLoop run_loop; |
115 prompt.ShowDialog( | 115 prompt.ShowDialog( |
116 nullptr, // no delegate | 116 nullptr, // no delegate |
117 extension.get(), nullptr, | 117 extension.get(), nullptr, |
118 make_scoped_ptr(new ExtensionInstallPrompt::Prompt( | 118 make_scoped_ptr(new ExtensionInstallPrompt::Prompt( |
119 ExtensionInstallPrompt::PERMISSIONS_PROMPT)), | 119 ExtensionInstallPrompt::PERMISSIONS_PROMPT)), |
120 permission_set.Pass(), | 120 std::move(permission_set), |
121 base::Bind(&VerifyPromptPermissionsCallback, run_loop.QuitClosure(), | 121 base::Bind(&VerifyPromptPermissionsCallback, run_loop.QuitClosure(), |
122 1u, // |regular_permissions_count|. | 122 1u, // |regular_permissions_count|. |
123 0u)); // |withheld_permissions_count|. | 123 0u)); // |withheld_permissions_count|. |
124 run_loop.Run(); | 124 run_loop.Run(); |
125 } | 125 } |
126 | 126 |
127 TEST_F(ExtensionInstallPromptUnitTest, PromptShowsWithheldPermissions) { | 127 TEST_F(ExtensionInstallPromptUnitTest, PromptShowsWithheldPermissions) { |
128 // Enable consent flag so that <all_hosts> permissions get withheld. | 128 // Enable consent flag so that <all_hosts> permissions get withheld. |
129 FeatureSwitch::ScopedOverride enable_scripts_switch( | 129 FeatureSwitch::ScopedOverride enable_scripts_switch( |
130 FeatureSwitch::scripts_require_action(), true); | 130 FeatureSwitch::scripts_require_action(), true); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 content::TestWebContentsFactory factory; | 177 content::TestWebContentsFactory factory; |
178 ExtensionInstallPrompt prompt(factory.CreateWebContents(profile())); | 178 ExtensionInstallPrompt prompt(factory.CreateWebContents(profile())); |
179 base::RunLoop run_loop; | 179 base::RunLoop run_loop; |
180 | 180 |
181 scoped_ptr<ExtensionInstallPrompt::Prompt> sub_prompt( | 181 scoped_ptr<ExtensionInstallPrompt::Prompt> sub_prompt( |
182 new ExtensionInstallPrompt::Prompt( | 182 new ExtensionInstallPrompt::Prompt( |
183 ExtensionInstallPrompt::DELEGATED_PERMISSIONS_PROMPT)); | 183 ExtensionInstallPrompt::DELEGATED_PERMISSIONS_PROMPT)); |
184 sub_prompt->set_delegated_username("Username"); | 184 sub_prompt->set_delegated_username("Username"); |
185 prompt.ShowDialog( | 185 prompt.ShowDialog( |
186 nullptr, // no delegate | 186 nullptr, // no delegate |
187 extension.get(), nullptr, sub_prompt.Pass(), | 187 extension.get(), nullptr, std::move(sub_prompt), |
188 base::Bind(&VerifyPromptPermissionsCallback, run_loop.QuitClosure(), | 188 base::Bind(&VerifyPromptPermissionsCallback, run_loop.QuitClosure(), |
189 2u, // |regular_permissions_count|. | 189 2u, // |regular_permissions_count|. |
190 0u)); // |withheld_permissions_count|. | 190 0u)); // |withheld_permissions_count|. |
191 run_loop.Run(); | 191 run_loop.Run(); |
192 } | 192 } |
193 | 193 |
194 using ExtensionInstallPromptTestWithService = ExtensionServiceTestWithInstall; | 194 using ExtensionInstallPromptTestWithService = ExtensionServiceTestWithInstall; |
195 | 195 |
196 TEST_F(ExtensionInstallPromptTestWithService, ExtensionInstallPromptIconsTest) { | 196 TEST_F(ExtensionInstallPromptTestWithService, ExtensionInstallPromptIconsTest) { |
197 InitializeEmptyExtensionService(); | 197 InitializeEmptyExtensionService(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 prompt.ShowDialog(nullptr, // No delegate. | 236 prompt.ShowDialog(nullptr, // No delegate. |
237 extension, | 237 extension, |
238 app_icon.bitmap(), // Use a different icon. | 238 app_icon.bitmap(), // Use a different icon. |
239 base::Bind(&VerifyPromptIconCallback, | 239 base::Bind(&VerifyPromptIconCallback, |
240 run_loop.QuitClosure(), *app_icon.bitmap())); | 240 run_loop.QuitClosure(), *app_icon.bitmap())); |
241 run_loop.Run(); | 241 run_loop.Run(); |
242 } | 242 } |
243 } | 243 } |
244 | 244 |
245 } // namespace extensions | 245 } // namespace extensions |
OLD | NEW |