| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 base::Bind(&WebApkInstallerRunner::OnCompleted, base::Unretained(this)), | 122 base::Bind(&WebApkInstallerRunner::OnCompleted, base::Unretained(this)), |
| 123 kIconMurmur2Hash, | 123 kIconMurmur2Hash, |
| 124 kDownloadedWebApkPackageName, | 124 kDownloadedWebApkPackageName, |
| 125 kWebApkVersion); | 125 kWebApkVersion); |
| 126 | 126 |
| 127 Run(); | 127 Run(); |
| 128 } | 128 } |
| 129 | 129 |
| 130 WebApkInstaller* CreateWebApkInstaller() { | 130 WebApkInstaller* CreateWebApkInstaller() { |
| 131 ShortcutInfo info(GURL::EmptyGURL()); | 131 ShortcutInfo info(GURL::EmptyGURL()); |
| 132 info.icon_url = icon_url_; | 132 info.best_icon_url = icon_url_; |
| 133 | 133 |
| 134 // WebApkInstaller owns itself. | 134 // WebApkInstaller owns itself. |
| 135 WebApkInstaller* installer = new TestWebApkInstaller(info, SkBitmap()); | 135 WebApkInstaller* installer = new TestWebApkInstaller(info, SkBitmap()); |
| 136 installer->SetTimeoutMs(100); | 136 installer->SetTimeoutMs(100); |
| 137 return installer; | 137 return installer; |
| 138 } | 138 } |
| 139 | 139 |
| 140 void Run() { | 140 void Run() { |
| 141 base::RunLoop run_loop; | 141 base::RunLoop run_loop; |
| 142 on_completed_callback_ = run_loop.QuitClosure(); | 142 on_completed_callback_ = run_loop.QuitClosure(); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 runner->RunInstallWebApk(); | 349 runner->RunInstallWebApk(); |
| 350 EXPECT_FALSE(runner->success()); | 350 EXPECT_FALSE(runner->success()); |
| 351 } | 351 } |
| 352 | 352 |
| 353 // Test update succeeding. | 353 // Test update succeeding. |
| 354 TEST_F(WebApkInstallerTest, UpdateSuccess) { | 354 TEST_F(WebApkInstallerTest, UpdateSuccess) { |
| 355 std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner(); | 355 std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner(); |
| 356 runner->RunUpdateWebApk(); | 356 runner->RunUpdateWebApk(); |
| 357 EXPECT_TRUE(runner->success()); | 357 EXPECT_TRUE(runner->success()); |
| 358 } | 358 } |
| OLD | NEW |