| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/renderer_host/input/render_widget_host_latency_tracker
.h" | 5 #include "content/browser/renderer_host/input/render_widget_host_latency_tracker
.h" |
| 6 #include "base/metrics/metrics_hashes.h" | 6 #include "base/metrics/metrics_hashes.h" |
| 7 #include "base/test/histogram_tester.h" | 7 #include "base/test/histogram_tester.h" |
| 8 #include "components/metrics/proto/ukm/entry.pb.h" | 8 #include "components/metrics/proto/ukm/entry.pb.h" |
| 9 #include "components/rappor/public/rappor_utils.h" | 9 #include "components/rappor/public/rappor_utils.h" |
| 10 #include "components/rappor/test_rappor_service.h" | 10 #include "components/rappor/test_rappor_service.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 private: | 91 private: |
| 92 rappor::TestRapporServiceImpl rappor_service_; | 92 rappor::TestRapporServiceImpl rappor_service_; |
| 93 ukm::TestUkmRecorder test_ukm_recorder_; | 93 ukm::TestUkmRecorder test_ukm_recorder_; |
| 94 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostLatencyTrackerTestBrowserClient); | 94 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostLatencyTrackerTestBrowserClient); |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 class RenderWidgetHostLatencyTrackerTest | 97 class RenderWidgetHostLatencyTrackerTest |
| 98 : public RenderViewHostImplTestHarness { | 98 : public RenderViewHostImplTestHarness { |
| 99 public: | 99 public: |
| 100 RenderWidgetHostLatencyTrackerTest() : old_browser_client_(NULL) { | 100 RenderWidgetHostLatencyTrackerTest() |
| 101 : tracker_(false), old_browser_client_(NULL) { |
| 101 tracker_.Initialize(kTestRoutingId, kTestProcessId); | 102 tracker_.Initialize(kTestRoutingId, kTestProcessId); |
| 102 ResetHistograms(); | 103 ResetHistograms(); |
| 103 } | 104 } |
| 104 | 105 |
| 105 ::testing::AssertionResult RapporSampleAssert(const char* rappor_name, | 106 ::testing::AssertionResult RapporSampleAssert(const char* rappor_name, |
| 106 int count) { | 107 int count) { |
| 107 rappor::TestSample::Shadow* sample_obj = | 108 rappor::TestSample::Shadow* sample_obj = |
| 108 test_browser_client_.getTestRapporService()->GetRecordedSampleForMetric( | 109 test_browser_client_.getTestRapporService()->GetRecordedSampleForMetric( |
| 109 rappor_name); | 110 rappor_name); |
| 110 if (count) { | 111 if (count) { |
| (...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1387 "QueueingDurationWhenExpectedQueueingTime_GreaterThan.300ms"), | 1388 "QueueingDurationWhenExpectedQueueingTime_GreaterThan.300ms"), |
| 1388 ElementsAre(Bucket(event_timestamps_ms[1] - event_timestamps_ms[0], 1))); | 1389 ElementsAre(Bucket(event_timestamps_ms[1] - event_timestamps_ms[0], 1))); |
| 1389 | 1390 |
| 1390 EXPECT_THAT(histogram_tester().GetAllSamples( | 1391 EXPECT_THAT(histogram_tester().GetAllSamples( |
| 1391 "RendererScheduler." | 1392 "RendererScheduler." |
| 1392 "QueueingDurationWhenExpectedQueueingTime_GreaterThan.450ms"), | 1393 "QueueingDurationWhenExpectedQueueingTime_GreaterThan.450ms"), |
| 1393 ElementsAre()); | 1394 ElementsAre()); |
| 1394 } | 1395 } |
| 1395 | 1396 |
| 1396 } // namespace content | 1397 } // namespace content |
| OLD | NEW |