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

Side by Side Diff: chrome/browser/installable/installable_manager_browsertest.cc

Issue 2844383004: Split the NOT_STARTED and STOPPED_BEFORE_COMPLETION installability metrics. (Closed)
Patch Set: Fix comment Created 3 years, 7 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/installable/installable_manager.h" 5 #include "chrome/browser/installable/installable_manager.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/threading/thread_task_runner_handle.h" 9 #include "base/threading/thread_task_runner_handle.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 // If there is no manifest, everything should be empty. 232 // If there is no manifest, everything should be empty.
233 EXPECT_TRUE(tester->manifest().IsEmpty()); 233 EXPECT_TRUE(tester->manifest().IsEmpty());
234 EXPECT_TRUE(tester->manifest_url().is_empty()); 234 EXPECT_TRUE(tester->manifest_url().is_empty());
235 EXPECT_TRUE(tester->primary_icon_url().is_empty()); 235 EXPECT_TRUE(tester->primary_icon_url().is_empty());
236 EXPECT_EQ(nullptr, tester->primary_icon()); 236 EXPECT_EQ(nullptr, tester->primary_icon());
237 EXPECT_FALSE(tester->is_installable()); 237 EXPECT_FALSE(tester->is_installable());
238 EXPECT_TRUE(tester->badge_icon_url().is_empty()); 238 EXPECT_TRUE(tester->badge_icon_url().is_empty());
239 EXPECT_EQ(nullptr, tester->badge_icon()); 239 EXPECT_EQ(nullptr, tester->badge_icon());
240 EXPECT_EQ(NO_MANIFEST, tester->error_code()); 240 EXPECT_EQ(NO_MANIFEST, tester->error_code());
241 EXPECT_EQ(GetStatus(), InstallabilityCheckStatus::NOT_STARTED); 241 EXPECT_EQ(GetStatus(),
242 InstallabilityCheckStatus::COMPLETE_NON_PROGRESSIVE_WEB_APP);
242 } 243 }
243 244
244 IN_PROC_BROWSER_TEST_F(InstallableManagerBrowserTest, CheckManifest404) { 245 IN_PROC_BROWSER_TEST_F(InstallableManagerBrowserTest, CheckManifest404) {
245 base::RunLoop run_loop; 246 base::RunLoop run_loop;
246 std::unique_ptr<CallbackTester> tester( 247 std::unique_ptr<CallbackTester> tester(
247 new CallbackTester(run_loop.QuitClosure())); 248 new CallbackTester(run_loop.QuitClosure()));
248 249
249 NavigateAndRunInstallableManager(tester.get(), GetManifestParams(), 250 NavigateAndRunInstallableManager(tester.get(), GetManifestParams(),
250 GetURLOfPageWithServiceWorkerAndManifest( 251 GetURLOfPageWithServiceWorkerAndManifest(
251 "/banners/manifest_missing.json")); 252 "/banners/manifest_missing.json"));
252 run_loop.Run(); 253 run_loop.Run();
253 254
254 // The installable manager should return a manifest URL even if it 404s. 255 // The installable manager should return a manifest URL even if it 404s.
255 // However, the check should fail with a ManifestEmpty error. 256 // However, the check should fail with a ManifestEmpty error.
256 EXPECT_TRUE(tester->manifest().IsEmpty()); 257 EXPECT_TRUE(tester->manifest().IsEmpty());
257 258
258 EXPECT_FALSE(tester->manifest_url().is_empty()); 259 EXPECT_FALSE(tester->manifest_url().is_empty());
259 EXPECT_TRUE(tester->primary_icon_url().is_empty()); 260 EXPECT_TRUE(tester->primary_icon_url().is_empty());
260 EXPECT_EQ(nullptr, tester->primary_icon()); 261 EXPECT_EQ(nullptr, tester->primary_icon());
261 EXPECT_FALSE(tester->is_installable()); 262 EXPECT_FALSE(tester->is_installable());
262 EXPECT_TRUE(tester->badge_icon_url().is_empty()); 263 EXPECT_TRUE(tester->badge_icon_url().is_empty());
263 EXPECT_EQ(nullptr, tester->badge_icon()); 264 EXPECT_EQ(nullptr, tester->badge_icon());
264 EXPECT_EQ(MANIFEST_EMPTY, tester->error_code()); 265 EXPECT_EQ(MANIFEST_EMPTY, tester->error_code());
265 EXPECT_EQ(GetStatus(), InstallabilityCheckStatus::NOT_STARTED); 266 EXPECT_EQ(GetStatus(),
267 InstallabilityCheckStatus::COMPLETE_NON_PROGRESSIVE_WEB_APP);
266 } 268 }
267 269
268 IN_PROC_BROWSER_TEST_F(InstallableManagerBrowserTest, CheckManifestOnly) { 270 IN_PROC_BROWSER_TEST_F(InstallableManagerBrowserTest, CheckManifestOnly) {
269 // Verify that asking for just the manifest works as expected. 271 // Verify that asking for just the manifest works as expected.
270 base::RunLoop run_loop; 272 base::RunLoop run_loop;
271 std::unique_ptr<CallbackTester> tester( 273 std::unique_ptr<CallbackTester> tester(
272 new CallbackTester(run_loop.QuitClosure())); 274 new CallbackTester(run_loop.QuitClosure()));
273 275
274 NavigateAndRunInstallableManager(tester.get(), GetManifestParams(), 276 NavigateAndRunInstallableManager(tester.get(), GetManifestParams(),
275 "/banners/manifest_test_page.html"); 277 "/banners/manifest_test_page.html");
276 run_loop.Run(); 278 run_loop.Run();
277 279
278 EXPECT_FALSE(tester->manifest().IsEmpty()); 280 EXPECT_FALSE(tester->manifest().IsEmpty());
279 EXPECT_FALSE(tester->manifest_url().is_empty()); 281 EXPECT_FALSE(tester->manifest_url().is_empty());
280 282
281 EXPECT_TRUE(tester->primary_icon_url().is_empty()); 283 EXPECT_TRUE(tester->primary_icon_url().is_empty());
282 EXPECT_EQ(nullptr, tester->primary_icon()); 284 EXPECT_EQ(nullptr, tester->primary_icon());
283 EXPECT_FALSE(tester->is_installable()); 285 EXPECT_FALSE(tester->is_installable());
284 EXPECT_TRUE(tester->badge_icon_url().is_empty()); 286 EXPECT_TRUE(tester->badge_icon_url().is_empty());
285 EXPECT_EQ(nullptr, tester->badge_icon()); 287 EXPECT_EQ(nullptr, tester->badge_icon());
286 EXPECT_EQ(NO_ERROR_DETECTED, tester->error_code()); 288 EXPECT_EQ(NO_ERROR_DETECTED, tester->error_code());
287 EXPECT_EQ(GetStatus(), InstallabilityCheckStatus::NOT_STARTED); 289 EXPECT_EQ(GetStatus(), InstallabilityCheckStatus::NOT_COMPLETED);
288 } 290 }
289 291
290 IN_PROC_BROWSER_TEST_F(InstallableManagerBrowserTest, 292 IN_PROC_BROWSER_TEST_F(InstallableManagerBrowserTest,
291 CheckInstallableParamsDefaultConstructor) { 293 CheckInstallableParamsDefaultConstructor) {
292 // Verify that using InstallableParams' default constructor is equivalent to 294 // Verify that using InstallableParams' default constructor is equivalent to
293 // just asking for the manifest alone. 295 // just asking for the manifest alone.
294 base::RunLoop run_loop; 296 base::RunLoop run_loop;
295 std::unique_ptr<CallbackTester> tester( 297 std::unique_ptr<CallbackTester> tester(
296 new CallbackTester(run_loop.QuitClosure())); 298 new CallbackTester(run_loop.QuitClosure()));
297 299
298 InstallableParams params; 300 InstallableParams params;
299 NavigateAndRunInstallableManager(tester.get(), params, 301 NavigateAndRunInstallableManager(tester.get(), params,
300 "/banners/manifest_test_page.html"); 302 "/banners/manifest_test_page.html");
301 run_loop.Run(); 303 run_loop.Run();
302 304
303 EXPECT_FALSE(tester->manifest().IsEmpty()); 305 EXPECT_FALSE(tester->manifest().IsEmpty());
304 EXPECT_FALSE(tester->manifest_url().is_empty()); 306 EXPECT_FALSE(tester->manifest_url().is_empty());
305 307
306 EXPECT_TRUE(tester->primary_icon_url().is_empty()); 308 EXPECT_TRUE(tester->primary_icon_url().is_empty());
307 EXPECT_EQ(nullptr, tester->primary_icon()); 309 EXPECT_EQ(nullptr, tester->primary_icon());
308 EXPECT_FALSE(tester->is_installable()); 310 EXPECT_FALSE(tester->is_installable());
309 EXPECT_TRUE(tester->badge_icon_url().is_empty()); 311 EXPECT_TRUE(tester->badge_icon_url().is_empty());
310 EXPECT_EQ(nullptr, tester->badge_icon()); 312 EXPECT_EQ(nullptr, tester->badge_icon());
311 EXPECT_EQ(NO_ERROR_DETECTED, tester->error_code()); 313 EXPECT_EQ(NO_ERROR_DETECTED, tester->error_code());
312 EXPECT_EQ(GetStatus(), InstallabilityCheckStatus::NOT_STARTED); 314 EXPECT_EQ(GetStatus(), InstallabilityCheckStatus::NOT_COMPLETED);
313 } 315 }
314 316
315 IN_PROC_BROWSER_TEST_F(InstallableManagerBrowserTest, 317 IN_PROC_BROWSER_TEST_F(InstallableManagerBrowserTest,
316 CheckManifestWithOnlyRelatedApplications) { 318 CheckManifestWithOnlyRelatedApplications) {
317 // This page has a manifest with only related applications specified. Asking 319 // This page has a manifest with only related applications specified. Asking
318 // for just the manifest should succeed. 320 // for just the manifest should succeed.
319 { 321 {
320 base::RunLoop run_loop; 322 base::RunLoop run_loop;
321 std::unique_ptr<CallbackTester> tester( 323 std::unique_ptr<CallbackTester> tester(
322 new CallbackTester(run_loop.QuitClosure())); 324 new CallbackTester(run_loop.QuitClosure()));
323 325
324 NavigateAndRunInstallableManager(tester.get(), GetManifestParams(), 326 NavigateAndRunInstallableManager(tester.get(), GetManifestParams(),
325 "/banners/play_app_test_page.html"); 327 "/banners/play_app_test_page.html");
326 run_loop.Run(); 328 run_loop.Run();
327 329
328 EXPECT_FALSE(tester->manifest().IsEmpty()); 330 EXPECT_FALSE(tester->manifest().IsEmpty());
329 EXPECT_FALSE(tester->manifest_url().is_empty()); 331 EXPECT_FALSE(tester->manifest_url().is_empty());
330 EXPECT_TRUE(tester->manifest().prefer_related_applications); 332 EXPECT_TRUE(tester->manifest().prefer_related_applications);
331 333
332 EXPECT_TRUE(tester->primary_icon_url().is_empty()); 334 EXPECT_TRUE(tester->primary_icon_url().is_empty());
333 EXPECT_EQ(nullptr, tester->primary_icon()); 335 EXPECT_EQ(nullptr, tester->primary_icon());
334 EXPECT_FALSE(tester->is_installable()); 336 EXPECT_FALSE(tester->is_installable());
335 EXPECT_TRUE(tester->badge_icon_url().is_empty()); 337 EXPECT_TRUE(tester->badge_icon_url().is_empty());
336 EXPECT_EQ(nullptr, tester->badge_icon()); 338 EXPECT_EQ(nullptr, tester->badge_icon());
337 EXPECT_EQ(NO_ERROR_DETECTED, tester->error_code()); 339 EXPECT_EQ(NO_ERROR_DETECTED, tester->error_code());
338 EXPECT_EQ(GetStatus(), InstallabilityCheckStatus::NOT_STARTED); 340 EXPECT_EQ(GetStatus(), InstallabilityCheckStatus::NOT_COMPLETED);
339 } 341 }
340 342
341 // Ask for a primary icon (but don't navigate). This should fail with 343 // Ask for a primary icon (but don't navigate). This should fail with
342 // NO_ACCEPTABLE_ICON. 344 // NO_ACCEPTABLE_ICON.
343 { 345 {
344 base::RunLoop run_loop; 346 base::RunLoop run_loop;
345 std::unique_ptr<CallbackTester> tester( 347 std::unique_ptr<CallbackTester> tester(
346 new CallbackTester(run_loop.QuitClosure())); 348 new CallbackTester(run_loop.QuitClosure()));
347 349
348 RunInstallableManager(tester.get(), GetPrimaryIconParams()); 350 RunInstallableManager(tester.get(), GetPrimaryIconParams());
349 run_loop.Run(); 351 run_loop.Run();
350 352
351 EXPECT_FALSE(tester->manifest().IsEmpty()); 353 EXPECT_FALSE(tester->manifest().IsEmpty());
352 EXPECT_FALSE(tester->manifest_url().is_empty()); 354 EXPECT_FALSE(tester->manifest_url().is_empty());
353 EXPECT_TRUE(tester->manifest().prefer_related_applications); 355 EXPECT_TRUE(tester->manifest().prefer_related_applications);
354 356
355 EXPECT_TRUE(tester->primary_icon_url().is_empty()); 357 EXPECT_TRUE(tester->primary_icon_url().is_empty());
356 EXPECT_EQ(nullptr, tester->primary_icon()); 358 EXPECT_EQ(nullptr, tester->primary_icon());
357 EXPECT_FALSE(tester->is_installable()); 359 EXPECT_FALSE(tester->is_installable());
358 EXPECT_TRUE(tester->badge_icon_url().is_empty()); 360 EXPECT_TRUE(tester->badge_icon_url().is_empty());
359 EXPECT_EQ(nullptr, tester->badge_icon()); 361 EXPECT_EQ(nullptr, tester->badge_icon());
360 EXPECT_EQ(NO_ACCEPTABLE_ICON, tester->error_code()); 362 EXPECT_EQ(NO_ACCEPTABLE_ICON, tester->error_code());
361 EXPECT_EQ(GetStatus(), InstallabilityCheckStatus::NOT_STARTED); 363 EXPECT_EQ(GetStatus(),
364 InstallabilityCheckStatus::COMPLETE_NON_PROGRESSIVE_WEB_APP);
362 } 365 }
363 366
364 // Ask for everything except badge icon. This should fail with 367 // Ask for everything except badge icon. This should fail with
365 // NO_ACCEPTABLE_ICON - the primary icon fetch has already failed, so that 368 // NO_ACCEPTABLE_ICON - the primary icon fetch has already failed, so that
366 // cached error stops the installable check from being performed. 369 // cached error stops the installable check from being performed.
367 { 370 {
368 base::RunLoop run_loop; 371 base::RunLoop run_loop;
369 std::unique_ptr<CallbackTester> tester( 372 std::unique_ptr<CallbackTester> tester(
370 new CallbackTester(run_loop.QuitClosure())); 373 new CallbackTester(run_loop.QuitClosure()));
371 374
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 428
426 EXPECT_FALSE(tester->manifest().IsEmpty()); 429 EXPECT_FALSE(tester->manifest().IsEmpty());
427 EXPECT_FALSE(tester->manifest_url().is_empty()); 430 EXPECT_FALSE(tester->manifest_url().is_empty());
428 431
429 EXPECT_FALSE(tester->primary_icon_url().is_empty()); 432 EXPECT_FALSE(tester->primary_icon_url().is_empty());
430 EXPECT_NE(nullptr, tester->primary_icon()); 433 EXPECT_NE(nullptr, tester->primary_icon());
431 EXPECT_FALSE(tester->is_installable()); 434 EXPECT_FALSE(tester->is_installable());
432 EXPECT_TRUE(tester->badge_icon_url().is_empty()); 435 EXPECT_TRUE(tester->badge_icon_url().is_empty());
433 EXPECT_EQ(nullptr, tester->badge_icon()); 436 EXPECT_EQ(nullptr, tester->badge_icon());
434 EXPECT_EQ(NO_ERROR_DETECTED, tester->error_code()); 437 EXPECT_EQ(NO_ERROR_DETECTED, tester->error_code());
435 EXPECT_EQ(GetStatus(), InstallabilityCheckStatus::NOT_STARTED); 438 EXPECT_EQ(GetStatus(), InstallabilityCheckStatus::NOT_COMPLETED);
436 } 439 }
437 440
438 // Add to homescreen checks for manifest + primary icon + badge icon. 441 // Add to homescreen checks for manifest + primary icon + badge icon.
439 { 442 {
440 base::RunLoop run_loop; 443 base::RunLoop run_loop;
441 std::unique_ptr<CallbackTester> tester( 444 std::unique_ptr<CallbackTester> tester(
442 new CallbackTester(run_loop.QuitClosure())); 445 new CallbackTester(run_loop.QuitClosure()));
443 446
444 RunInstallableManager(tester.get(), GetPrimaryIconAndBadgeIconParams()); 447 RunInstallableManager(tester.get(), GetPrimaryIconAndBadgeIconParams());
445 run_loop.Run(); 448 run_loop.Run();
446 449
447 EXPECT_FALSE(tester->manifest().IsEmpty()); 450 EXPECT_FALSE(tester->manifest().IsEmpty());
448 EXPECT_FALSE(tester->manifest_url().is_empty()); 451 EXPECT_FALSE(tester->manifest_url().is_empty());
449 452
450 EXPECT_FALSE(tester->primary_icon_url().is_empty()); 453 EXPECT_FALSE(tester->primary_icon_url().is_empty());
451 EXPECT_NE(nullptr, tester->primary_icon()); 454 EXPECT_NE(nullptr, tester->primary_icon());
452 EXPECT_FALSE(tester->is_installable()); 455 EXPECT_FALSE(tester->is_installable());
453 EXPECT_FALSE(tester->badge_icon_url().is_empty()); 456 EXPECT_FALSE(tester->badge_icon_url().is_empty());
454 EXPECT_NE(nullptr, tester->badge_icon()); 457 EXPECT_NE(nullptr, tester->badge_icon());
455 EXPECT_EQ(NO_ERROR_DETECTED, tester->error_code()); 458 EXPECT_EQ(NO_ERROR_DETECTED, tester->error_code());
456 EXPECT_EQ(GetStatus(), InstallabilityCheckStatus::NOT_STARTED); 459 EXPECT_EQ(GetStatus(), InstallabilityCheckStatus::NOT_COMPLETED);
457 } 460 }
458 461
459 // Request an oversized badge icon. This should fetch only the manifest and 462 // Request an oversized badge icon. This should fetch only the manifest and
460 // the primary icon, and return no errors. 463 // the primary icon, and return no errors.
461 { 464 {
462 base::RunLoop run_loop; 465 base::RunLoop run_loop;
463 std::unique_ptr<CallbackTester> tester( 466 std::unique_ptr<CallbackTester> tester(
464 new CallbackTester(run_loop.QuitClosure())); 467 new CallbackTester(run_loop.QuitClosure()));
465 468
466 InstallableParams params = GetPrimaryIconAndBadgeIconParams(); 469 InstallableParams params = GetPrimaryIconAndBadgeIconParams();
467 params.ideal_badge_icon_size_in_px = 2000; 470 params.ideal_badge_icon_size_in_px = 2000;
468 params.minimum_badge_icon_size_in_px = 2000; 471 params.minimum_badge_icon_size_in_px = 2000;
469 RunInstallableManager(tester.get(), params); 472 RunInstallableManager(tester.get(), params);
470 run_loop.Run(); 473 run_loop.Run();
471 474
472 EXPECT_FALSE(tester->manifest().IsEmpty()); 475 EXPECT_FALSE(tester->manifest().IsEmpty());
473 EXPECT_FALSE(tester->manifest_url().is_empty()); 476 EXPECT_FALSE(tester->manifest_url().is_empty());
474 477
475 EXPECT_FALSE(tester->primary_icon_url().is_empty()); 478 EXPECT_FALSE(tester->primary_icon_url().is_empty());
476 EXPECT_NE(nullptr, tester->primary_icon()); 479 EXPECT_NE(nullptr, tester->primary_icon());
477 EXPECT_FALSE(tester->is_installable()); 480 EXPECT_FALSE(tester->is_installable());
478 EXPECT_TRUE(tester->badge_icon_url().is_empty()); 481 EXPECT_TRUE(tester->badge_icon_url().is_empty());
479 EXPECT_EQ(nullptr, tester->badge_icon()); 482 EXPECT_EQ(nullptr, tester->badge_icon());
480 EXPECT_EQ(NO_ERROR_DETECTED, tester->error_code()); 483 EXPECT_EQ(NO_ERROR_DETECTED, tester->error_code());
481 EXPECT_EQ(GetStatus(), InstallabilityCheckStatus::NOT_STARTED); 484 EXPECT_EQ(GetStatus(), InstallabilityCheckStatus::NOT_COMPLETED);
482 } 485 }
483 486
484 // Navigate to a page with a bad badge icon. This should now fail with 487 // Navigate to a page with a bad badge icon. This should now fail with
485 // NO_ICON_AVAILABLE, but still have the manifest and primary icon. 488 // NO_ICON_AVAILABLE, but still have the manifest and primary icon.
486 { 489 {
487 base::RunLoop run_loop; 490 base::RunLoop run_loop;
488 std::unique_ptr<CallbackTester> tester( 491 std::unique_ptr<CallbackTester> tester(
489 new CallbackTester(run_loop.QuitClosure())); 492 new CallbackTester(run_loop.QuitClosure()));
490 493
491 NavigateAndRunInstallableManager(tester.get(), 494 NavigateAndRunInstallableManager(tester.get(),
492 GetPrimaryIconAndBadgeIconParams(), 495 GetPrimaryIconAndBadgeIconParams(),
493 GetURLOfPageWithServiceWorkerAndManifest( 496 GetURLOfPageWithServiceWorkerAndManifest(
494 "/banners/manifest_bad_badge.json")); 497 "/banners/manifest_bad_badge.json"));
495 run_loop.Run(); 498 run_loop.Run();
496 499
497 EXPECT_FALSE(tester->manifest().IsEmpty()); 500 EXPECT_FALSE(tester->manifest().IsEmpty());
498 EXPECT_FALSE(tester->manifest_url().is_empty()); 501 EXPECT_FALSE(tester->manifest_url().is_empty());
499 502
500 EXPECT_FALSE(tester->primary_icon_url().is_empty()); 503 EXPECT_FALSE(tester->primary_icon_url().is_empty());
501 EXPECT_NE(nullptr, tester->primary_icon()); 504 EXPECT_NE(nullptr, tester->primary_icon());
502 EXPECT_TRUE(tester->badge_icon_url().is_empty()); 505 EXPECT_TRUE(tester->badge_icon_url().is_empty());
503 EXPECT_EQ(nullptr, tester->badge_icon()); 506 EXPECT_EQ(nullptr, tester->badge_icon());
504 EXPECT_FALSE(tester->is_installable()); 507 EXPECT_FALSE(tester->is_installable());
505 EXPECT_EQ(NO_ICON_AVAILABLE, tester->error_code()); 508 EXPECT_EQ(NO_ICON_AVAILABLE, tester->error_code());
506 EXPECT_EQ(GetStatus(), InstallabilityCheckStatus::NOT_STARTED); 509 EXPECT_EQ(GetStatus(),
510 InstallabilityCheckStatus::COMPLETE_NON_PROGRESSIVE_WEB_APP);
507 } 511 }
508 } 512 }
509 513
510 IN_PROC_BROWSER_TEST_F(InstallableManagerBrowserTest, CheckWebapp) { 514 IN_PROC_BROWSER_TEST_F(InstallableManagerBrowserTest, CheckWebapp) {
511 // Request everything except badge icon. 515 // Request everything except badge icon.
512 { 516 {
513 base::RunLoop run_loop; 517 base::RunLoop run_loop;
514 std::unique_ptr<CallbackTester> tester( 518 std::unique_ptr<CallbackTester> tester(
515 new CallbackTester(run_loop.QuitClosure())); 519 new CallbackTester(run_loop.QuitClosure()));
516 520
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 637
634 EXPECT_FALSE(tester->manifest().IsEmpty()); 638 EXPECT_FALSE(tester->manifest().IsEmpty());
635 EXPECT_FALSE(tester->manifest_url().is_empty()); 639 EXPECT_FALSE(tester->manifest_url().is_empty());
636 640
637 EXPECT_TRUE(tester->primary_icon_url().is_empty()); 641 EXPECT_TRUE(tester->primary_icon_url().is_empty());
638 EXPECT_EQ(nullptr, tester->primary_icon()); 642 EXPECT_EQ(nullptr, tester->primary_icon());
639 EXPECT_FALSE(tester->is_installable()); 643 EXPECT_FALSE(tester->is_installable());
640 EXPECT_TRUE(tester->badge_icon_url().is_empty()); 644 EXPECT_TRUE(tester->badge_icon_url().is_empty());
641 EXPECT_EQ(nullptr, tester->badge_icon()); 645 EXPECT_EQ(nullptr, tester->badge_icon());
642 EXPECT_EQ(NO_ERROR_DETECTED, tester->error_code()); 646 EXPECT_EQ(NO_ERROR_DETECTED, tester->error_code());
643 EXPECT_EQ(GetStatus(), InstallabilityCheckStatus::NOT_STARTED); 647 EXPECT_EQ(GetStatus(), InstallabilityCheckStatus::NOT_COMPLETED);
644 } 648 }
645 649
646 // Fetch the full criteria should fail. 650 // Fetch the full criteria should fail.
647 { 651 {
648 base::RunLoop run_loop; 652 base::RunLoop run_loop;
649 std::unique_ptr<CallbackTester> tester( 653 std::unique_ptr<CallbackTester> tester(
650 new CallbackTester(run_loop.QuitClosure())); 654 new CallbackTester(run_loop.QuitClosure()));
651 655
652 RunInstallableManager(tester.get(), GetWebAppParams()); 656 RunInstallableManager(tester.get(), GetWebAppParams());
653 run_loop.Run(); 657 run_loop.Run();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 run_loop.Run(); 735 run_loop.Run();
732 736
733 EXPECT_FALSE(tester->manifest().IsEmpty()); 737 EXPECT_FALSE(tester->manifest().IsEmpty());
734 EXPECT_FALSE(tester->manifest_url().is_empty()); 738 EXPECT_FALSE(tester->manifest_url().is_empty());
735 EXPECT_TRUE(tester->primary_icon_url().is_empty()); 739 EXPECT_TRUE(tester->primary_icon_url().is_empty());
736 EXPECT_EQ(nullptr, tester->primary_icon()); 740 EXPECT_EQ(nullptr, tester->primary_icon());
737 EXPECT_FALSE(tester->is_installable()); 741 EXPECT_FALSE(tester->is_installable());
738 EXPECT_TRUE(tester->badge_icon_url().is_empty()); 742 EXPECT_TRUE(tester->badge_icon_url().is_empty());
739 EXPECT_EQ(nullptr, tester->badge_icon()); 743 EXPECT_EQ(nullptr, tester->badge_icon());
740 EXPECT_EQ(NO_ICON_AVAILABLE, tester->error_code()); 744 EXPECT_EQ(NO_ICON_AVAILABLE, tester->error_code());
741 EXPECT_EQ(GetStatus(), InstallabilityCheckStatus::NOT_STARTED); 745 EXPECT_EQ(GetStatus(),
746 InstallabilityCheckStatus::COMPLETE_NON_PROGRESSIVE_WEB_APP);
742 } 747 }
743 748
744 IN_PROC_BROWSER_TEST_F(InstallableManagerBrowserTest, 749 IN_PROC_BROWSER_TEST_F(InstallableManagerBrowserTest,
745 CheckChangeInIconDimensions) { 750 CheckChangeInIconDimensions) {
746 // Verify that a follow-up request for a primary icon with a different size 751 // Verify that a follow-up request for a primary icon with a different size
747 // works. 752 // works.
748 { 753 {
749 base::RunLoop run_loop; 754 base::RunLoop run_loop;
750 std::unique_ptr<CallbackTester> tester( 755 std::unique_ptr<CallbackTester> tester(
751 new CallbackTester(run_loop.QuitClosure())); 756 new CallbackTester(run_loop.QuitClosure()));
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 CheckNestedCallsToGetData) { 841 CheckNestedCallsToGetData) {
837 // Verify that we can call GetData while in a callback from GetData. 842 // Verify that we can call GetData while in a callback from GetData.
838 base::RunLoop run_loop; 843 base::RunLoop run_loop;
839 InstallableParams params = GetWebAppParams(); 844 InstallableParams params = GetWebAppParams();
840 std::unique_ptr<NestedCallbackTester> tester( 845 std::unique_ptr<NestedCallbackTester> tester(
841 new NestedCallbackTester(GetManager(), params, run_loop.QuitClosure())); 846 new NestedCallbackTester(GetManager(), params, run_loop.QuitClosure()));
842 847
843 tester->Run(); 848 tester->Run();
844 run_loop.Run(); 849 run_loop.Run();
845 } 850 }
OLDNEW
« no previous file with comments | « chrome/browser/installable/installable_manager.cc ('k') | chrome/browser/installable/installable_metrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698