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

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

Issue 2822883002: Fix test slowness introduced by https://codereview.chromium.org/2771793003 (Closed)
Patch Set: Created 3 years, 8 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 }; 342 };
343 343
344 // Test installation succeeding. 344 // Test installation succeeding.
345 TEST_F(WebApkInstallerTest, Success) { 345 TEST_F(WebApkInstallerTest, Success) {
346 std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner(); 346 std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner();
347 runner->RunInstallWebApk(); 347 runner->RunInstallWebApk();
348 EXPECT_EQ(WebApkInstallResult::SUCCESS, runner->result()); 348 EXPECT_EQ(WebApkInstallResult::SUCCESS, runner->result());
349 } 349 }
350 350
351 // Test that installation fails if fetching the bitmap at the best primary icon 351 // Test that installation fails if fetching the bitmap at the best primary icon
352 // URL times out. In a perfect world the fetch would never time out because the 352 // URL returns no content. In a perfect world the fetch would always succeed
353 // bitmap at the best primary icon URL should be in the HTTP cache. 353 // because the fetch for the same icon succeeded recently.
354 TEST_F(WebApkInstallerTest, BestPrimaryIconUrlDownloadTimesOut) { 354 TEST_F(WebApkInstallerTest, BestPrimaryIconUrlDownloadTimesOut) {
355 SetBestPrimaryIconUrl(test_server()->GetURL("/slow?1000")); 355 SetBestPrimaryIconUrl(test_server()->GetURL("/nocontent"));
356 356
357 std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner(); 357 std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner();
358 runner->RunInstallWebApk(); 358 runner->RunInstallWebApk();
359 EXPECT_EQ(WebApkInstallResult::FAILURE, runner->result()); 359 EXPECT_EQ(WebApkInstallResult::FAILURE, runner->result());
360 } 360 }
361 361
362 // Test that installation fails if fetching the bitmap at the best badge icon 362 // Test that installation fails if fetching the bitmap at the best badge icon
363 // URL times out. In a perfect world the fetch would never time out because the 363 // URL returns no content. In a perfect world the fetch would always succeed
364 // bitmap at the best badge icon URL should be in the HTTP cache. 364 // because the fetch for the same icon succeeded recently.
365 TEST_F(WebApkInstallerTest, BestBadgeIconUrlDownloadTimesOut) { 365 TEST_F(WebApkInstallerTest, BestBadgeIconUrlDownloadTimesOut) {
366 SetBestBadgeIconUrl(test_server()->GetURL("/slow?1000")); 366 SetBestBadgeIconUrl(test_server()->GetURL("/nocontent"));
367 367
368 std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner(); 368 std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner();
369 runner->RunInstallWebApk(); 369 runner->RunInstallWebApk();
370 EXPECT_EQ(WebApkInstallResult::FAILURE, runner->result()); 370 EXPECT_EQ(WebApkInstallResult::FAILURE, runner->result());
371 } 371 }
372 372
373 // Test that installation fails if the WebAPK creation request times out. 373 // Test that installation fails if the WebAPK creation request times out.
374 TEST_F(WebApkInstallerTest, CreateWebApkRequestTimesOut) { 374 TEST_F(WebApkInstallerTest, CreateWebApkRequestTimesOut) {
375 SetWebApkServerUrl(test_server()->GetURL("/slow?1000")); 375 SetWebApkServerUrl(test_server()->GetURL("/slow?1000"));
376 376
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 webapk::Image::BADGE_ICON)); 545 webapk::Image::BADGE_ICON));
546 EXPECT_TRUE(icons[1].has_image_data()); 546 EXPECT_TRUE(icons[1].has_image_data());
547 } 547 }
548 548
549 TEST_F(WebApkInstallerTest, FailsWhenInstallDisabled) { 549 TEST_F(WebApkInstallerTest, FailsWhenInstallDisabled) {
550 std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner(); 550 std::unique_ptr<WebApkInstallerRunner> runner = CreateWebApkInstallerRunner();
551 runner->SetCanInstallWebApks(false); 551 runner->SetCanInstallWebApks(false);
552 runner->RunInstallWebApk(); 552 runner->RunInstallWebApk();
553 EXPECT_EQ(WebApkInstallResult::FAILURE, runner->result()); 553 EXPECT_EQ(WebApkInstallResult::FAILURE, runner->result());
554 } 554 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698