OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/page_load_metrics/observers/core_page_load_metrics_obse rver.h" | 5 #include "chrome/browser/page_load_metrics/observers/core_page_load_metrics_obse rver.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_ test_harness.h" | 8 #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_ test_harness.h" |
9 #include "chrome/browser/page_load_metrics/page_load_metrics_util.h" | 9 #include "chrome/browser/page_load_metrics/page_load_metrics_util.h" |
10 #include "chrome/test/base/testing_browser_process.h" | 10 #include "chrome/test/base/testing_browser_process.h" |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
411 base::TimeDelta::FromMilliseconds(10); | 411 base::TimeDelta::FromMilliseconds(10); |
412 PopulateRequiredTimingFields(&timing); | 412 PopulateRequiredTimingFields(&timing); |
413 | 413 |
414 GURL url(kDefaultTestUrl); | 414 GURL url(kDefaultTestUrl); |
415 NavigateWithPageTransitionAndCommit(url, ui::PAGE_TRANSITION_RELOAD); | 415 NavigateWithPageTransitionAndCommit(url, ui::PAGE_TRANSITION_RELOAD); |
416 SimulateTimingUpdate(timing); | 416 SimulateTimingUpdate(timing); |
417 | 417 |
418 page_load_metrics::ExtraRequestInfo resources[] = { | 418 page_load_metrics::ExtraRequestInfo resources[] = { |
419 // Cached request. | 419 // Cached request. |
420 {true /*was_cached*/, 1024 * 20 /* raw_body_bytes */, | 420 {true /*was_cached*/, 1024 * 20 /* raw_body_bytes */, |
421 false /* data_reduction_proxy_used*/, | 421 0 /* original_network_content_length */, nullptr}, |
bengr
2017/04/20 23:19:36
Perhaps comment everywhere that this is d_r_p_data
RyanSturm
2017/04/21 16:25:04
Done.
| |
422 0 /* original_network_content_length */}, | |
423 // Uncached non-proxied request. | 422 // Uncached non-proxied request. |
424 {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, | 423 {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, |
425 false /* data_reduction_proxy_used*/, | 424 1024 * 40 /* original_network_content_length */, nullptr}, |
426 1024 * 40 /* original_network_content_length */}, | |
427 }; | 425 }; |
428 | 426 |
429 int64_t network_bytes = 0; | 427 int64_t network_bytes = 0; |
430 int64_t cache_bytes = 0; | 428 int64_t cache_bytes = 0; |
431 for (const auto& request : resources) { | 429 for (const auto& request : resources) { |
432 SimulateLoadedResource(request); | 430 SimulateLoadedResource(request); |
433 if (!request.was_cached) { | 431 if (!request.was_cached) { |
434 network_bytes += request.raw_body_bytes; | 432 network_bytes += request.raw_body_bytes; |
435 } else { | 433 } else { |
436 cache_bytes += request.raw_body_bytes; | 434 cache_bytes += request.raw_body_bytes; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
497 // modifier. This test verifies that when we encounter such a page, we log it | 495 // modifier. This test verifies that when we encounter such a page, we log it |
498 // as a forward/back navigation. | 496 // as a forward/back navigation. |
499 NavigateWithPageTransitionAndCommit( | 497 NavigateWithPageTransitionAndCommit( |
500 url, ui::PageTransitionFromInt(ui::PAGE_TRANSITION_RELOAD | | 498 url, ui::PageTransitionFromInt(ui::PAGE_TRANSITION_RELOAD | |
501 ui::PAGE_TRANSITION_FORWARD_BACK)); | 499 ui::PAGE_TRANSITION_FORWARD_BACK)); |
502 SimulateTimingUpdate(timing); | 500 SimulateTimingUpdate(timing); |
503 | 501 |
504 page_load_metrics::ExtraRequestInfo resources[] = { | 502 page_load_metrics::ExtraRequestInfo resources[] = { |
505 // Cached request. | 503 // Cached request. |
506 {true /*was_cached*/, 1024 * 20 /* raw_body_bytes */, | 504 {true /*was_cached*/, 1024 * 20 /* raw_body_bytes */, |
507 false /* data_reduction_proxy_used*/, | 505 0 /* original_network_content_length */, nullptr}, |
508 0 /* original_network_content_length */}, | |
509 // Uncached non-proxied request. | 506 // Uncached non-proxied request. |
510 {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, | 507 {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, |
511 false /* data_reduction_proxy_used*/, | 508 1024 * 40 /* original_network_content_length */, nullptr}, |
512 1024 * 40 /* original_network_content_length */}, | |
513 }; | 509 }; |
514 | 510 |
515 int64_t network_bytes = 0; | 511 int64_t network_bytes = 0; |
516 int64_t cache_bytes = 0; | 512 int64_t cache_bytes = 0; |
517 for (const auto& request : resources) { | 513 for (const auto& request : resources) { |
518 SimulateLoadedResource(request); | 514 SimulateLoadedResource(request); |
519 if (!request.was_cached) { | 515 if (!request.was_cached) { |
520 network_bytes += request.raw_body_bytes; | 516 network_bytes += request.raw_body_bytes; |
521 } else { | 517 } else { |
522 cache_bytes += request.raw_body_bytes; | 518 cache_bytes += request.raw_body_bytes; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
577 base::TimeDelta::FromMilliseconds(10); | 573 base::TimeDelta::FromMilliseconds(10); |
578 PopulateRequiredTimingFields(&timing); | 574 PopulateRequiredTimingFields(&timing); |
579 | 575 |
580 GURL url(kDefaultTestUrl); | 576 GURL url(kDefaultTestUrl); |
581 NavigateWithPageTransitionAndCommit(url, ui::PAGE_TRANSITION_LINK); | 577 NavigateWithPageTransitionAndCommit(url, ui::PAGE_TRANSITION_LINK); |
582 SimulateTimingUpdate(timing); | 578 SimulateTimingUpdate(timing); |
583 | 579 |
584 page_load_metrics::ExtraRequestInfo resources[] = { | 580 page_load_metrics::ExtraRequestInfo resources[] = { |
585 // Cached request. | 581 // Cached request. |
586 {true /*was_cached*/, 1024 * 20 /* raw_body_bytes */, | 582 {true /*was_cached*/, 1024 * 20 /* raw_body_bytes */, |
587 false /* data_reduction_proxy_used*/, | 583 0 /* original_network_content_length */, nullptr}, |
588 0 /* original_network_content_length */}, | |
589 // Uncached non-proxied request. | 584 // Uncached non-proxied request. |
590 {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, | 585 {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, |
591 false /* data_reduction_proxy_used*/, | 586 1024 * 40 /* original_network_content_length */, nullptr}, |
592 1024 * 40 /* original_network_content_length */}, | |
593 }; | 587 }; |
594 | 588 |
595 int64_t network_bytes = 0; | 589 int64_t network_bytes = 0; |
596 int64_t cache_bytes = 0; | 590 int64_t cache_bytes = 0; |
597 for (auto request : resources) { | 591 for (const auto& request : resources) { |
598 SimulateLoadedResource(request); | 592 SimulateLoadedResource(request); |
599 if (!request.was_cached) { | 593 if (!request.was_cached) { |
600 network_bytes += request.raw_body_bytes; | 594 network_bytes += request.raw_body_bytes; |
601 } else { | 595 } else { |
602 cache_bytes += request.raw_body_bytes; | 596 cache_bytes += request.raw_body_bytes; |
603 } | 597 } |
604 } | 598 } |
605 | 599 |
606 NavigateToUntrackedUrl(); | 600 NavigateToUntrackedUrl(); |
607 | 601 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
707 NavigateAndCommit(GURL(kDefaultTestUrl2)); | 701 NavigateAndCommit(GURL(kDefaultTestUrl2)); |
708 | 702 |
709 histogram_tester().ExpectTotalCount( | 703 histogram_tester().ExpectTotalCount( |
710 internal::kHistogramFirstMeaningfulPaint, 0); | 704 internal::kHistogramFirstMeaningfulPaint, 0); |
711 histogram_tester().ExpectTotalCount( | 705 histogram_tester().ExpectTotalCount( |
712 internal::kHistogramParseStartToFirstMeaningfulPaint, 0); | 706 internal::kHistogramParseStartToFirstMeaningfulPaint, 0); |
713 histogram_tester().ExpectBucketCount( | 707 histogram_tester().ExpectBucketCount( |
714 internal::kHistogramFirstMeaningfulPaintStatus, | 708 internal::kHistogramFirstMeaningfulPaintStatus, |
715 internal::FIRST_MEANINGFUL_PAINT_USER_INTERACTION_BEFORE_FMP, 1); | 709 internal::FIRST_MEANINGFUL_PAINT_USER_INTERACTION_BEFORE_FMP, 1); |
716 } | 710 } |
OLD | NEW |