| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/scoped_observer.h" | 8 #include "base/scoped_observer.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // Regression test for http://crbug.com/144991. | 134 // Regression test for http://crbug.com/144991. |
| 135 IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerTest, InstallFromHostedApp) { | 135 IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerTest, InstallFromHostedApp) { |
| 136 AutoAcceptInstall(); | 136 AutoAcceptInstall(); |
| 137 | 137 |
| 138 const GURL kInstallUrl = GenerateTestServerUrl(kAppDomain, "install.html"); | 138 const GURL kInstallUrl = GenerateTestServerUrl(kAppDomain, "install.html"); |
| 139 | 139 |
| 140 // We're forced to construct a hosted app dynamically because we need the | 140 // We're forced to construct a hosted app dynamically because we need the |
| 141 // app to run on a declared URL, but we don't know the port ahead of time. | 141 // app to run on a declared URL, but we don't know the port ahead of time. |
| 142 scoped_refptr<const Extension> hosted_app = | 142 scoped_refptr<const Extension> hosted_app = |
| 143 ExtensionBuilder() | 143 ExtensionBuilder() |
| 144 .SetManifest(std::move( | 144 .SetManifest( |
| 145 DictionaryBuilder() | 145 DictionaryBuilder() |
| 146 .Set("name", "hosted app") | 146 .Set("name", "hosted app") |
| 147 .Set("version", "1") | 147 .Set("version", "1") |
| 148 .Set("app", | 148 .Set( |
| 149 std::move( | 149 "app", |
| 150 DictionaryBuilder() | 150 DictionaryBuilder() |
| 151 .Set("urls", std::move(ListBuilder().Append( | 151 .Set("urls", |
| 152 kInstallUrl.spec()))) | 152 ListBuilder().Append(kInstallUrl.spec()).Build()) |
| 153 .Set("launch", | 153 .Set("launch", DictionaryBuilder() |
| 154 std::move(DictionaryBuilder().Set( | 154 .Set("web_url", kInstallUrl.spec()) |
| 155 "web_url", kInstallUrl.spec()))))) | 155 .Build()) |
| 156 .Set("manifest_version", 2))) | 156 .Build()) |
| 157 .Set("manifest_version", 2) |
| 158 .Build()) |
| 157 .Build(); | 159 .Build(); |
| 158 ASSERT_TRUE(hosted_app.get()); | 160 ASSERT_TRUE(hosted_app.get()); |
| 159 | 161 |
| 160 ExtensionService* extension_service = | 162 ExtensionService* extension_service = |
| 161 extensions::ExtensionSystem::Get(browser()->profile())-> | 163 extensions::ExtensionSystem::Get(browser()->profile())-> |
| 162 extension_service(); | 164 extension_service(); |
| 163 extensions::ExtensionRegistry* registry = | 165 extensions::ExtensionRegistry* registry = |
| 164 extensions::ExtensionRegistry::Get(browser()->profile()); | 166 extensions::ExtensionRegistry::Get(browser()->profile()); |
| 165 | 167 |
| 166 extension_service->AddExtension(hosted_app.get()); | 168 extension_service->AddExtension(hosted_app.get()); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 229 |
| 228 IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallUnpackFailureTest, | 230 IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallUnpackFailureTest, |
| 229 WebstoreStartupInstallUnpackFailureTest) { | 231 WebstoreStartupInstallUnpackFailureTest) { |
| 230 AutoAcceptInstall(); | 232 AutoAcceptInstall(); |
| 231 | 233 |
| 232 ui_test_utils::NavigateToURL(browser(), | 234 ui_test_utils::NavigateToURL(browser(), |
| 233 GenerateTestServerUrl(kAppDomain, "install_unpack_failure.html")); | 235 GenerateTestServerUrl(kAppDomain, "install_unpack_failure.html")); |
| 234 | 236 |
| 235 RunTest("runTest"); | 237 RunTest("runTest"); |
| 236 } | 238 } |
| OLD | NEW |