| 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 "base/files/scoped_temp_dir.h" | 5 #include "base/files/scoped_temp_dir.h" |
| 6 #include "base/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/test/histogram_tester.h" | 7 #include "base/test/histogram_tester.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h" | 9 #include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h" |
| 10 #include "chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_ob
server.h" | 10 #include "chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_ob
server.h" |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 ui_test_utils::NavigateToURL( | 472 ui_test_utils::NavigateToURL( |
| 473 browser(), embedded_test_server()->GetURL( | 473 browser(), embedded_test_server()->GetURL( |
| 474 "/page_load_metrics/document_write_no_script.html")); | 474 "/page_load_metrics/document_write_no_script.html")); |
| 475 NavigateToUntrackedUrl(); | 475 NavigateToUntrackedUrl(); |
| 476 | 476 |
| 477 histogram_tester_.ExpectTotalCount( | 477 histogram_tester_.ExpectTotalCount( |
| 478 internal::kHistogramDocWriteBlockParseStartToFirstContentfulPaint, 0); | 478 internal::kHistogramDocWriteBlockParseStartToFirstContentfulPaint, 0); |
| 479 histogram_tester_.ExpectTotalCount(internal::kHistogramDocWriteBlockCount, 0); | 479 histogram_tester_.ExpectTotalCount(internal::kHistogramDocWriteBlockCount, 0); |
| 480 } | 480 } |
| 481 | 481 |
| 482 IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, BadXhtml) { | 482 // TODO(crbug.com/712935): Flaky on Linux dbg. |
| 483 #if defined(OS_LINUX) && !defined(NDEBUG) |
| 484 #define MAYBE_BadXhtml DISABLED_BadXhtml |
| 485 #else |
| 486 #define MAYBE_BadXhtml BadXhtml |
| 487 #endif |
| 488 IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, MAYBE_BadXhtml) { |
| 483 ASSERT_TRUE(embedded_test_server()->Start()); | 489 ASSERT_TRUE(embedded_test_server()->Start()); |
| 484 | 490 |
| 485 scoped_refptr<TimingUpdatedObserver> timing_observer = | 491 scoped_refptr<TimingUpdatedObserver> timing_observer = |
| 486 CreateTimingUpdatedObserver(); | 492 CreateTimingUpdatedObserver(); |
| 487 timing_observer->AddMatchingFields(TimingUpdatedObserver::FIRST_PAINT); | 493 timing_observer->AddMatchingFields(TimingUpdatedObserver::FIRST_PAINT); |
| 488 | 494 |
| 489 // When an XHTML page contains invalid XML, it causes a paint of the error | 495 // When an XHTML page contains invalid XML, it causes a paint of the error |
| 490 // message without a layout. Page load metrics currently treats this as an | 496 // message without a layout. Page load metrics currently treats this as an |
| 491 // error. Eventually, we'll fix this by special casing the handling of | 497 // error. Eventually, we'll fix this by special casing the handling of |
| 492 // documents with non-well-formed XML on the blink side. See crbug.com/627607 | 498 // documents with non-well-formed XML on the blink side. See crbug.com/627607 |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL( | 783 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL( |
| 778 "/page_load_metrics/large.html")); | 784 "/page_load_metrics/large.html")); |
| 779 NavigateToUntrackedUrl(); | 785 NavigateToUntrackedUrl(); |
| 780 | 786 |
| 781 histogram_tester_.ExpectTotalCount(internal::kHistogramTotalBytes, 1); | 787 histogram_tester_.ExpectTotalCount(internal::kHistogramTotalBytes, 1); |
| 782 | 788 |
| 783 // Verify that there is a single sample recorded in the 10kB bucket (the size | 789 // Verify that there is a single sample recorded in the 10kB bucket (the size |
| 784 // of the main HTML response). | 790 // of the main HTML response). |
| 785 histogram_tester_.ExpectBucketCount(internal::kHistogramTotalBytes, 10, 1); | 791 histogram_tester_.ExpectBucketCount(internal::kHistogramTotalBytes, 10, 1); |
| 786 } | 792 } |
| OLD | NEW |