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