| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/android/webapk/webapk_installer.h" | 5 #include "chrome/browser/android/webapk/webapk_installer.h" |
| 6 | 6 |
| 7 #include <jni.h> | 7 #include <jni.h> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 const std::string kIconMurmur2Hash = "0"; | 106 const std::string kIconMurmur2Hash = "0"; |
| 107 const int kWebApkVersion = 1; | 107 const int kWebApkVersion = 1; |
| 108 | 108 |
| 109 WebApkInstaller* installer = CreateWebApkInstaller(); | 109 WebApkInstaller* installer = CreateWebApkInstaller(); |
| 110 | 110 |
| 111 installer->UpdateAsyncWithURLRequestContextGetter( | 111 installer->UpdateAsyncWithURLRequestContextGetter( |
| 112 url_request_context_getter_.get(), | 112 url_request_context_getter_.get(), |
| 113 base::Bind(&WebApkInstallerRunner::OnCompleted, base::Unretained(this)), | 113 base::Bind(&WebApkInstallerRunner::OnCompleted, base::Unretained(this)), |
| 114 kIconMurmur2Hash, | 114 kIconMurmur2Hash, |
| 115 kDownloadedWebApkPackageName, | 115 kDownloadedWebApkPackageName, |
| 116 kWebApkVersion); | 116 kWebApkVersion, |
| 117 false /* stale_manifest */, |
| 118 std::vector<std::string>()); |
| 117 | 119 |
| 118 Run(); | 120 Run(); |
| 119 } | 121 } |
| 120 | 122 |
| 121 WebApkInstaller* CreateWebApkInstaller() { | 123 WebApkInstaller* CreateWebApkInstaller() { |
| 122 ShortcutInfo info(GURL::EmptyGURL()); | 124 ShortcutInfo info(GURL::EmptyGURL()); |
| 123 info.best_icon_url = best_icon_url_; | 125 info.best_icon_url = best_icon_url_; |
| 124 | 126 |
| 125 // WebApkInstaller owns itself. | 127 // WebApkInstaller owns itself. |
| 126 WebApkInstaller* installer = new TestWebApkInstaller(info, SkBitmap()); | 128 WebApkInstaller* installer = new TestWebApkInstaller(info, SkBitmap()); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 runner->RunInstallWebApk(); | 326 runner->RunInstallWebApk(); |
| 325 EXPECT_FALSE(runner->success()); | 327 EXPECT_FALSE(runner->success()); |
| 326 } | 328 } |
| 327 | 329 |
| 328 // Test update succeeding. | 330 // Test update succeeding. |
| 329 TEST_F(WebApkInstallerTest, UpdateSuccess) { | 331 TEST_F(WebApkInstallerTest, UpdateSuccess) { |
| 330 std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner(); | 332 std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner(); |
| 331 runner->RunUpdateWebApk(); | 333 runner->RunUpdateWebApk(); |
| 332 EXPECT_TRUE(runner->success()); | 334 EXPECT_TRUE(runner->success()); |
| 333 } | 335 } |
| OLD | NEW |