| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 160 |
| 161 void Run() { | 161 void Run() { |
| 162 base::RunLoop run_loop; | 162 base::RunLoop run_loop; |
| 163 on_completed_callback_ = run_loop.QuitClosure(); | 163 on_completed_callback_ = run_loop.QuitClosure(); |
| 164 run_loop.Run(); | 164 run_loop.Run(); |
| 165 } | 165 } |
| 166 | 166 |
| 167 bool success() { return success_; } | 167 bool success() { return success_; } |
| 168 | 168 |
| 169 private: | 169 private: |
| 170 void OnCompleted(bool success, const std::string& webapk_package) { | 170 void OnCompleted(bool success, |
| 171 const WebApkInstaller::FinishCallbackData& data) { |
| 171 success_ = success; | 172 success_ = success; |
| 172 on_completed_callback_.Run(); | 173 on_completed_callback_.Run(); |
| 173 } | 174 } |
| 174 | 175 |
| 175 content::BrowserContext* browser_context_; | 176 content::BrowserContext* browser_context_; |
| 176 | 177 |
| 177 // The Web Manifest's icon URL. | 178 // The Web Manifest's icon URL. |
| 178 const GURL best_icon_url_; | 179 const GURL best_icon_url_; |
| 179 | 180 |
| 180 // Called after the installation process has succeeded or failed. | 181 // Called after the installation process has succeeded or failed. |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 icons[i] = manifest.icons(i); | 510 icons[i] = manifest.icons(i); |
| 510 | 511 |
| 511 EXPECT_EQ(best_icon_url.spec(), icons[0].src()); | 512 EXPECT_EQ(best_icon_url.spec(), icons[0].src()); |
| 512 EXPECT_EQ(best_icon_murmur2_hash, icons[0].hash()); | 513 EXPECT_EQ(best_icon_murmur2_hash, icons[0].hash()); |
| 513 EXPECT_TRUE(icons[0].has_image_data()); | 514 EXPECT_TRUE(icons[0].has_image_data()); |
| 514 | 515 |
| 515 EXPECT_EQ(icon_url_1.spec(), icons[1].src()); | 516 EXPECT_EQ(icon_url_1.spec(), icons[1].src()); |
| 516 EXPECT_EQ(icon_murmur2_hash_1, icons[1].hash()); | 517 EXPECT_EQ(icon_murmur2_hash_1, icons[1].hash()); |
| 517 EXPECT_FALSE(icons[1].has_image_data()); | 518 EXPECT_FALSE(icons[1].has_image_data()); |
| 518 } | 519 } |
| OLD | NEW |