Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: chrome/browser/android/webapk/webapk_installer_unittest.cc

Issue 2632243004: Don't download identical APKs on update. (Closed)
Patch Set: Nits. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 EXPECT_FALSE(runner->success()); 417 EXPECT_FALSE(runner->success());
418 } 418 }
419 419
420 // Test update succeeding. 420 // Test update succeeding.
421 TEST_F(WebApkInstallerTest, UpdateSuccess) { 421 TEST_F(WebApkInstallerTest, UpdateSuccess) {
422 std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner(); 422 std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner();
423 runner->RunUpdateWebApk(); 423 runner->RunUpdateWebApk();
424 EXPECT_TRUE(runner->success()); 424 EXPECT_TRUE(runner->success());
425 } 425 }
426 426
427 // Test that updates suceeded if the WebAPK server returns a HTTP response with
428 // an empty download URL.
pkotwicz 2017/02/10 02:50:31 Nits: "updates" -> "an update" "succeeded" -> "suc
Xi Han 2017/02/10 18:21:09 Done.
429 TEST_F(WebApkInstallerTest, UpdateSuccessWithEmptyDownloadUrlInResponse) {
430 SetWebApkResponseBuilder(base::Bind(&BuildValidWebApkResponse, GURL()));
431
432 std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner();
433 runner->RunUpdateWebApk();
434 EXPECT_TRUE(runner->success());
435 }
436
427 // Test installation succeeds using Google Play. 437 // Test installation succeeds using Google Play.
428 TEST_F(WebApkInstallerTest, InstallFromGooglePlaySuccess) { 438 TEST_F(WebApkInstallerTest, InstallFromGooglePlaySuccess) {
429 std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner(); 439 std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner();
430 runner->SetHasGooglePlayWebApkInstallDelegate(true); 440 runner->SetHasGooglePlayWebApkInstallDelegate(true);
431 runner->RunInstallWebApk(); 441 runner->RunInstallWebApk();
432 EXPECT_TRUE(runner->success()); 442 EXPECT_TRUE(runner->success());
433 } 443 }
434 444
435 // When there is no Web Manifest available for a site, an empty |best_icon_url| 445 // When there is no Web Manifest available for a site, an empty |best_icon_url|
436 // is used to build a WebApk update request. Tests the request can be built 446 // is used to build a WebApk update request. Tests the request can be built
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 icons[i] = manifest.icons(i); 506 icons[i] = manifest.icons(i);
497 507
498 EXPECT_EQ(best_icon_url.spec(), icons[0].src()); 508 EXPECT_EQ(best_icon_url.spec(), icons[0].src());
499 EXPECT_EQ(best_icon_murmur2_hash, icons[0].hash()); 509 EXPECT_EQ(best_icon_murmur2_hash, icons[0].hash());
500 EXPECT_TRUE(icons[0].has_image_data()); 510 EXPECT_TRUE(icons[0].has_image_data());
501 511
502 EXPECT_EQ(icon_url_1.spec(), icons[1].src()); 512 EXPECT_EQ(icon_url_1.spec(), icons[1].src());
503 EXPECT_EQ(icon_murmur2_hash_1, icons[1].hash()); 513 EXPECT_EQ(icon_murmur2_hash_1, icons[1].hash());
504 EXPECT_FALSE(icons[1].has_image_data()); 514 EXPECT_FALSE(icons[1].has_image_data());
505 } 515 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698