| 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/webstore_installer.h" | 5 #include "chrome/browser/extensions/webstore_installer.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 done_closure_.Run(); | 116 done_closure_.Run(); |
| 117 } | 117 } |
| 118 | 118 |
| 119 IN_PROC_BROWSER_TEST_F(WebstoreInstallerBrowserTest, WebstoreInstall) { | 119 IN_PROC_BROWSER_TEST_F(WebstoreInstallerBrowserTest, WebstoreInstall) { |
| 120 scoped_ptr<base::DictionaryValue> manifest( | 120 scoped_ptr<base::DictionaryValue> manifest( |
| 121 DictionaryBuilder() | 121 DictionaryBuilder() |
| 122 .Set("name", kExtensionName) | 122 .Set("name", kExtensionName) |
| 123 .Set("description", "Foo") | 123 .Set("description", "Foo") |
| 124 .Set("manifest_version", 2) | 124 .Set("manifest_version", 2) |
| 125 .Set("version", "1.0") | 125 .Set("version", "1.0") |
| 126 .Set("permissions", std::move(ListBuilder().Append("tabs"))) | 126 .Set("permissions", ListBuilder().Append("tabs").Build()) |
| 127 .Build()); | 127 .Build()); |
| 128 | 128 |
| 129 content::WebContents* active_web_contents = | 129 content::WebContents* active_web_contents = |
| 130 browser()->tab_strip_model()->GetActiveWebContents(); | 130 browser()->tab_strip_model()->GetActiveWebContents(); |
| 131 ASSERT_TRUE(active_web_contents); | 131 ASSERT_TRUE(active_web_contents); |
| 132 | 132 |
| 133 // Create an approval. | 133 // Create an approval. |
| 134 scoped_ptr<WebstoreInstaller::Approval> approval = | 134 scoped_ptr<WebstoreInstaller::Approval> approval = |
| 135 WebstoreInstaller::Approval::CreateWithNoInstallPrompt( | 135 WebstoreInstaller::Approval::CreateWithNoInstallPrompt( |
| 136 browser()->profile(), kTestExtensionId, std::move(manifest), false); | 136 browser()->profile(), kTestExtensionId, std::move(manifest), false); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 149 ASSERT_TRUE(registry->enabled_extensions().GetByID(kTestExtensionId)); | 149 ASSERT_TRUE(registry->enabled_extensions().GetByID(kTestExtensionId)); |
| 150 } | 150 } |
| 151 | 151 |
| 152 IN_PROC_BROWSER_TEST_F(WebstoreInstallerBrowserTest, SimultaneousInstall) { | 152 IN_PROC_BROWSER_TEST_F(WebstoreInstallerBrowserTest, SimultaneousInstall) { |
| 153 scoped_ptr<base::DictionaryValue> manifest( | 153 scoped_ptr<base::DictionaryValue> manifest( |
| 154 DictionaryBuilder() | 154 DictionaryBuilder() |
| 155 .Set("name", kExtensionName) | 155 .Set("name", kExtensionName) |
| 156 .Set("description", "Foo") | 156 .Set("description", "Foo") |
| 157 .Set("manifest_version", 2) | 157 .Set("manifest_version", 2) |
| 158 .Set("version", "1.0") | 158 .Set("version", "1.0") |
| 159 .Set("permissions", std::move(ListBuilder().Append("tabs"))) | 159 .Set("permissions", ListBuilder().Append("tabs").Build()) |
| 160 .Build()); | 160 .Build()); |
| 161 | 161 |
| 162 content::WebContents* active_web_contents = | 162 content::WebContents* active_web_contents = |
| 163 browser()->tab_strip_model()->GetActiveWebContents(); | 163 browser()->tab_strip_model()->GetActiveWebContents(); |
| 164 ASSERT_TRUE(active_web_contents); | 164 ASSERT_TRUE(active_web_contents); |
| 165 | 165 |
| 166 // Create an approval. | 166 // Create an approval. |
| 167 scoped_ptr<WebstoreInstaller::Approval> approval = | 167 scoped_ptr<WebstoreInstaller::Approval> approval = |
| 168 WebstoreInstaller::Approval::CreateWithNoInstallPrompt( | 168 WebstoreInstaller::Approval::CreateWithNoInstallPrompt( |
| 169 browser()->profile(), | 169 browser()->profile(), |
| (...skipping 29 matching lines...) Expand all Loading... |
| 199 installer = nullptr; | 199 installer = nullptr; |
| 200 run_loop2.Run(); | 200 run_loop2.Run(); |
| 201 | 201 |
| 202 EXPECT_TRUE(success()); | 202 EXPECT_TRUE(success()); |
| 203 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); | 203 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); |
| 204 // Extension ends up as disabled because of permissions. | 204 // Extension ends up as disabled because of permissions. |
| 205 ASSERT_TRUE(registry->disabled_extensions().GetByID(kTestExtensionId)); | 205 ASSERT_TRUE(registry->disabled_extensions().GetByID(kTestExtensionId)); |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace extensions | 208 } // namespace extensions |
| OLD | NEW |