Chromium Code Reviews| Index: chrome/browser/extensions/extension_install_prompt_unittest.cc |
| diff --git a/chrome/browser/extensions/extension_install_prompt_unittest.cc b/chrome/browser/extensions/extension_install_prompt_unittest.cc |
| index 75967dfb5a77e889e5cd606d48af3f8fc7b4e7a1..8aa93606184854ba1cdb4ef9addea05fcf49a3b3 100644 |
| --- a/chrome/browser/extensions/extension_install_prompt_unittest.cc |
| +++ b/chrome/browser/extensions/extension_install_prompt_unittest.cc |
| @@ -53,14 +53,14 @@ TEST(ExtensionInstallPromptUnittest, PromptShowsPermissionWarnings) { |
| .Set("version", "1.0") |
| .Set("manifest_version", 2) |
| .Set("description", "Random Ext")).Build(); |
| - ExtensionInstallPrompt prompt(NULL /* no web contents in this test */); |
| + ExtensionInstallPrompt prompt(nullptr /* no web contents in this test */); |
| base::RunLoop run_loop; |
| prompt.set_callback_for_test( |
| base::Bind(&VerifyPromptPermissionsCallback, |
| run_loop.QuitClosure(), |
| 1u, // |regular_permissions_count|. |
| 0u)); // |withheld_permissions_count|. |
| - prompt.ConfirmPermissions(NULL, // no delegate |
| + prompt.ConfirmPermissions(nullptr, // no delegate |
| extension.get(), |
| permission_set.get()); |
| run_loop.Run(); |
| @@ -84,13 +84,13 @@ TEST(ExtensionInstallPromptUnittest, PromptShowsWithheldPermissions) { |
| .Set("manifest_version", 2) |
| .Set("description", "Random Ext") |
| .Set("permissions", permissions)).Build(); |
| - ExtensionInstallPrompt prompt(NULL /* no web contents in this test */); |
| + ExtensionInstallPrompt prompt(nullptr /* no web contents in this test */); |
| base::RunLoop run_loop; |
| // We expect <all_hosts> to be withheld, but http://www.google.com/ and tabs |
| // permissions should be granted as regular permissions. |
| prompt.ConfirmInstall( |
| - NULL, |
| + nullptr, |
| extension.get(), |
| base::Bind(&VerifyPromptPermissionsCallback, |
| run_loop.QuitClosure(), |
| @@ -99,4 +99,33 @@ TEST(ExtensionInstallPromptUnittest, PromptShowsWithheldPermissions) { |
| run_loop.Run(); |
| } |
| +TEST(ExtensionInstallPromptUnittest, DelegatedPromptShowsOptionalPermissions) { |
| + content::TestBrowserThreadBundle thread_bundle; |
| + ListBuilder required_permissions; |
| + required_permissions.Append("tabs"); |
| + ListBuilder optional_permissions; |
| + optional_permissions.Append("location"); |
|
not at google - send to devlin
2015/03/03 17:33:26
Could you inline all of these (I don't know why th
Marc Treib
2015/03/04 10:33:43
Done, also in the previous test.
|
| + scoped_refptr<const Extension> extension = |
| + ExtensionBuilder().SetManifest( |
| + DictionaryBuilder().Set("name", "foo") |
| + .Set("version", "1.0") |
| + .Set("manifest_version", 2) |
| + .Set("description", "Random Ext") |
| + .Set("permissions", required_permissions) |
|
not at google - send to devlin
2015/03/03 17:33:26
E.g.
.Set("permissions",
ListBuilder().Appe
Marc Treib
2015/03/04 10:33:43
Done.
|
| + .Set("optional_permissions", |
| + optional_permissions)).Build(); |
| + ExtensionInstallPrompt prompt(nullptr /* no web contents in this test */); |
| + base::RunLoop run_loop; |
| + prompt.set_callback_for_test( |
| + base::Bind(&VerifyPromptPermissionsCallback, |
| + run_loop.QuitClosure(), |
| + 2u, // |regular_permissions_count|. |
| + 0u)); // |withheld_permissions_count|. |
| + prompt.ConfirmPermissionsForDelegatedInstall(nullptr, // no delegate |
| + extension.get(), |
| + "Username", |
| + nullptr); // no icon |
| + run_loop.Run(); |
| +} |
| + |
| } // namespace extensions |