| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 Run(); | 121 Run(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 WebApkInstaller* CreateWebApkInstaller() { | 124 WebApkInstaller* CreateWebApkInstaller() { |
| 125 ShortcutInfo info(GURL::EmptyGURL()); | 125 ShortcutInfo info(GURL::EmptyGURL()); |
| 126 info.icon_url = icon_url_; | 126 info.icon_url = icon_url_; |
| 127 | 127 |
| 128 // WebApkInstaller owns itself. | 128 // WebApkInstaller owns itself. |
| 129 WebApkInstaller* installer = new TestWebApkInstaller(info, SkBitmap()); | 129 WebApkInstaller* installer = new TestWebApkInstaller(info, SkBitmap()); |
| 130 installer->SetTimeoutMs(100); | 130 installer->SetTimeoutMs(200); |
| 131 return installer; | 131 return installer; |
| 132 } | 132 } |
| 133 | 133 |
| 134 void Run() { | 134 void Run() { |
| 135 base::RunLoop run_loop; | 135 base::RunLoop run_loop; |
| 136 on_completed_callback_ = run_loop.QuitClosure(); | 136 on_completed_callback_ = run_loop.QuitClosure(); |
| 137 run_loop.Run(); | 137 run_loop.Run(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 bool success() { return success_; } | 140 bool success() { return success_; } |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 runner->RunInstallWebApk(); | 339 runner->RunInstallWebApk(); |
| 340 EXPECT_FALSE(runner->success()); | 340 EXPECT_FALSE(runner->success()); |
| 341 } | 341 } |
| 342 | 342 |
| 343 // Test update succeeding. | 343 // Test update succeeding. |
| 344 TEST_F(WebApkInstallerTest, UpdateSuccess) { | 344 TEST_F(WebApkInstallerTest, UpdateSuccess) { |
| 345 std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner(); | 345 std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner(); |
| 346 runner->RunUpdateWebApk(); | 346 runner->RunUpdateWebApk(); |
| 347 EXPECT_TRUE(runner->success()); | 347 EXPECT_TRUE(runner->success()); |
| 348 } | 348 } |
| OLD | NEW |