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

Unified Diff: chrome/browser/page_load_metrics/observers/service_worker_page_load_metrics_observer_unittest.cc

Issue 2111073003: Update PageLoadTiming to use base::Optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@optionalbug
Patch Set: remove comment Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/page_load_metrics/observers/service_worker_page_load_metrics_observer_unittest.cc
diff --git a/chrome/browser/page_load_metrics/observers/service_worker_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/service_worker_page_load_metrics_observer_unittest.cc
index e95a63830a14dd7761b4a933a9d6bb43e2b0b8b4..c99e2569e650b13c397c9d121109b2f2d1808184 100644
--- a/chrome/browser/page_load_metrics/observers/service_worker_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/service_worker_page_load_metrics_observer_unittest.cc
@@ -94,7 +94,7 @@ TEST_F(ServiceWorkerPageLoadMetricsObserverTest, WithServiceWorker) {
internal::kHistogramServiceWorkerFirstContentfulPaint, 1);
histogram_tester().ExpectBucketCount(
internal::kHistogramServiceWorkerFirstContentfulPaint,
- timing.first_contentful_paint.InMilliseconds(), 1);
+ timing.first_contentful_paint.value().InMilliseconds(), 1);
histogram_tester().ExpectTotalCount(
internal::kBackgroundHistogramServiceWorkerFirstContentfulPaint, 0);
@@ -103,18 +103,20 @@ TEST_F(ServiceWorkerPageLoadMetricsObserverTest, WithServiceWorker) {
internal::kHistogramServiceWorkerParseStartToFirstContentfulPaint, 1);
histogram_tester().ExpectBucketCount(
internal::kHistogramServiceWorkerParseStartToFirstContentfulPaint,
- (timing.first_contentful_paint - timing.parse_start).InMilliseconds(), 1);
+ (timing.first_contentful_paint.value() - timing.parse_start.value())
+ .InMilliseconds(),
+ 1);
histogram_tester().ExpectTotalCount(
internal::kHistogramServiceWorkerDomContentLoaded, 1);
histogram_tester().ExpectBucketCount(
internal::kHistogramServiceWorkerDomContentLoaded,
- (timing.dom_content_loaded_event_start).InMilliseconds(), 1);
+ timing.dom_content_loaded_event_start.value().InMilliseconds(), 1);
histogram_tester().ExpectTotalCount(internal::kHistogramServiceWorkerLoad, 1);
histogram_tester().ExpectBucketCount(
internal::kHistogramServiceWorkerLoad,
- (timing.load_event_start).InMilliseconds(), 1);
+ timing.load_event_start.value().InMilliseconds(), 1);
AssertNoInboxHistogramsLogged();
}
@@ -143,7 +145,7 @@ TEST_F(ServiceWorkerPageLoadMetricsObserverTest, WithServiceWorkerBackground) {
internal::kBackgroundHistogramServiceWorkerFirstContentfulPaint, 1);
histogram_tester().ExpectBucketCount(
internal::kBackgroundHistogramServiceWorkerFirstContentfulPaint,
- timing.first_contentful_paint.InMilliseconds(), 1);
+ timing.first_contentful_paint.value().InMilliseconds(), 1);
histogram_tester().ExpectTotalCount(
internal::kHistogramServiceWorkerParseStartToFirstContentfulPaint, 0);
histogram_tester().ExpectTotalCount(
@@ -167,12 +169,12 @@ TEST_F(ServiceWorkerPageLoadMetricsObserverTest, InboxSite) {
internal::kHistogramServiceWorkerFirstContentfulPaint, 1);
histogram_tester().ExpectBucketCount(
internal::kHistogramServiceWorkerFirstContentfulPaint,
- timing.first_contentful_paint.InMilliseconds(), 1);
+ timing.first_contentful_paint.value().InMilliseconds(), 1);
histogram_tester().ExpectTotalCount(
internal::kHistogramServiceWorkerFirstContentfulPaintInbox, 1);
histogram_tester().ExpectBucketCount(
internal::kHistogramServiceWorkerFirstContentfulPaintInbox,
- timing.first_contentful_paint.InMilliseconds(), 1);
+ timing.first_contentful_paint.value().InMilliseconds(), 1);
histogram_tester().ExpectTotalCount(
internal::kBackgroundHistogramServiceWorkerFirstContentfulPaint, 0);
@@ -181,32 +183,36 @@ TEST_F(ServiceWorkerPageLoadMetricsObserverTest, InboxSite) {
internal::kHistogramServiceWorkerParseStartToFirstContentfulPaint, 1);
histogram_tester().ExpectBucketCount(
internal::kHistogramServiceWorkerParseStartToFirstContentfulPaint,
- (timing.first_contentful_paint - timing.parse_start).InMilliseconds(), 1);
+ (timing.first_contentful_paint.value() - timing.parse_start.value())
+ .InMilliseconds(),
+ 1);
histogram_tester().ExpectTotalCount(
internal::kHistogramServiceWorkerParseStartToFirstContentfulPaintInbox,
1);
histogram_tester().ExpectBucketCount(
internal::kHistogramServiceWorkerParseStartToFirstContentfulPaintInbox,
- (timing.first_contentful_paint - timing.parse_start).InMilliseconds(), 1);
+ (timing.first_contentful_paint.value() - timing.parse_start.value())
+ .InMilliseconds(),
+ 1);
histogram_tester().ExpectTotalCount(
internal::kHistogramServiceWorkerDomContentLoaded, 1);
histogram_tester().ExpectBucketCount(
internal::kHistogramServiceWorkerDomContentLoaded,
- (timing.dom_content_loaded_event_start).InMilliseconds(), 1);
+ timing.dom_content_loaded_event_start.value().InMilliseconds(), 1);
histogram_tester().ExpectTotalCount(
internal::kHistogramServiceWorkerDomContentLoadedInbox, 1);
histogram_tester().ExpectBucketCount(
internal::kHistogramServiceWorkerDomContentLoadedInbox,
- (timing.dom_content_loaded_event_start).InMilliseconds(), 1);
+ timing.dom_content_loaded_event_start.value().InMilliseconds(), 1);
histogram_tester().ExpectTotalCount(internal::kHistogramServiceWorkerLoad, 1);
histogram_tester().ExpectBucketCount(
internal::kHistogramServiceWorkerLoad,
- (timing.load_event_start).InMilliseconds(), 1);
+ timing.load_event_start.value().InMilliseconds(), 1);
histogram_tester().ExpectTotalCount(
internal::kHistogramServiceWorkerLoadInbox, 1);
histogram_tester().ExpectBucketCount(
internal::kHistogramServiceWorkerLoadInbox,
- (timing.load_event_start).InMilliseconds(), 1);
+ timing.load_event_start.value().InMilliseconds(), 1);
}

Powered by Google App Engine
This is Rietveld 408576698