| 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 "chrome/browser/extensions/extension_install_prompt.h" | 5 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 .Set("manifest_version", 2) | 113 .Set("manifest_version", 2) |
| 114 .Set("description", "Random Ext") | 114 .Set("description", "Random Ext") |
| 115 .Build()) | 115 .Build()) |
| 116 .Build(); | 116 .Build(); |
| 117 | 117 |
| 118 content::TestWebContentsFactory factory; | 118 content::TestWebContentsFactory factory; |
| 119 ExtensionInstallPrompt prompt(factory.CreateWebContents(profile())); | 119 ExtensionInstallPrompt prompt(factory.CreateWebContents(profile())); |
| 120 base::RunLoop run_loop; | 120 base::RunLoop run_loop; |
| 121 prompt.ShowDialog( | 121 prompt.ShowDialog( |
| 122 ExtensionInstallPrompt::DoneCallback(), extension.get(), nullptr, | 122 ExtensionInstallPrompt::DoneCallback(), extension.get(), nullptr, |
| 123 base::WrapUnique(new ExtensionInstallPrompt::Prompt( | 123 base::MakeUnique<ExtensionInstallPrompt::Prompt>( |
| 124 ExtensionInstallPrompt::PERMISSIONS_PROMPT)), | 124 ExtensionInstallPrompt::PERMISSIONS_PROMPT), |
| 125 std::move(permission_set), | 125 std::move(permission_set), |
| 126 base::Bind(&VerifyPromptPermissionsCallback, run_loop.QuitClosure(), | 126 base::Bind(&VerifyPromptPermissionsCallback, run_loop.QuitClosure(), |
| 127 1u, // |regular_permissions_count|. | 127 1u, // |regular_permissions_count|. |
| 128 0u)); // |withheld_permissions_count|. | 128 0u)); // |withheld_permissions_count|. |
| 129 run_loop.Run(); | 129 run_loop.Run(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 TEST_F(ExtensionInstallPromptUnitTest, PromptShowsWithheldPermissions) { | 132 TEST_F(ExtensionInstallPromptUnitTest, PromptShowsWithheldPermissions) { |
| 133 // Enable consent flag so that <all_hosts> permissions get withheld. | 133 // Enable consent flag so that <all_hosts> permissions get withheld. |
| 134 FeatureSwitch::ScopedOverride enable_scripts_switch( | 134 FeatureSwitch::ScopedOverride enable_scripts_switch( |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 prompt.ShowDialog(ExtensionInstallPrompt::DoneCallback(), | 241 prompt.ShowDialog(ExtensionInstallPrompt::DoneCallback(), |
| 242 extension, | 242 extension, |
| 243 app_icon.bitmap(), // Use a different icon. | 243 app_icon.bitmap(), // Use a different icon. |
| 244 base::Bind(&VerifyPromptIconCallback, | 244 base::Bind(&VerifyPromptIconCallback, |
| 245 run_loop.QuitClosure(), *app_icon.bitmap())); | 245 run_loop.QuitClosure(), *app_icon.bitmap())); |
| 246 run_loop.Run(); | 246 run_loop.Run(); |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 | 249 |
| 250 } // namespace extensions | 250 } // namespace extensions |
| OLD | NEW |