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

Unified Diff: cc/debug/frame_timing_tracker_unittest.cc

Issue 1897123002: Remove current implementation of frame timing events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 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
« no previous file with comments | « cc/debug/frame_timing_tracker.cc ('k') | cc/layers/layer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/debug/frame_timing_tracker_unittest.cc
diff --git a/cc/debug/frame_timing_tracker_unittest.cc b/cc/debug/frame_timing_tracker_unittest.cc
deleted file mode 100644
index 109b730dee8b0ca7ff0ff4237f29514bf36b7f21..0000000000000000000000000000000000000000
--- a/cc/debug/frame_timing_tracker_unittest.cc
+++ /dev/null
@@ -1,297 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <stdint.h>
-
-#include <set>
-#include <string>
-
-#include "base/time/time.h"
-#include "base/trace_event/trace_event_argument.h"
-#include "base/values.h"
-#include "cc/debug/frame_timing_tracker.h"
-#include "cc/test/fake_impl_task_runner_provider.h"
-#include "cc/test/fake_layer_tree_host_impl.h"
-#include "cc/test/test_shared_bitmap_manager.h"
-#include "cc/test/test_task_graph_runner.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace cc {
-namespace {
-
-std::string CompositeToString(
- std::unique_ptr<FrameTimingTracker::CompositeTimingSet> timingset) {
- std::unique_ptr<base::trace_event::TracedValue> value(
- new base::trace_event::TracedValue());
- value->BeginArray("values");
- std::set<int> rect_ids;
- for (const auto& pair : *timingset)
- rect_ids.insert(pair.first);
-
- for (const auto& rect_id : rect_ids) {
- auto& events = (*timingset)[rect_id];
- value->BeginDictionary();
- value->SetInteger("rect_id", rect_id);
- value->BeginArray("events");
- for (const auto& event : events) {
- value->BeginDictionary();
- value->SetInteger("frame_id", event.frame_id);
- value->SetInteger("timestamp", event.timestamp.ToInternalValue());
- value->EndDictionary();
- }
- value->EndArray();
- value->EndDictionary();
- }
- value->EndArray();
- return value->ToString();
-}
-
-std::string MainFrameToString(
- std::unique_ptr<FrameTimingTracker::MainFrameTimingSet> timingset) {
- std::unique_ptr<base::trace_event::TracedValue> value(
- new base::trace_event::TracedValue());
- value->BeginArray("values");
- std::set<int> rect_ids;
- for (const auto& pair : *timingset)
- rect_ids.insert(pair.first);
-
- for (const auto& rect_id : rect_ids) {
- auto& events = (*timingset)[rect_id];
- value->BeginDictionary();
- value->SetInteger("rect_id", rect_id);
- value->BeginArray("events");
- for (const auto& event : events) {
- value->BeginDictionary();
- value->SetInteger("end_time", event.end_time.ToInternalValue());
- value->SetInteger("frame_id", event.frame_id);
- value->SetInteger("timestamp", event.timestamp.ToInternalValue());
- value->EndDictionary();
- }
- value->EndArray();
- value->EndDictionary();
- }
- value->EndArray();
- return value->ToString();
-}
-
-TEST(FrameTimingTrackerTest, DefaultTrackerIsEmpty) {
- FakeImplTaskRunnerProvider task_runner_provider;
- TestSharedBitmapManager shared_bitmap_manager;
- TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
- &task_graph_runner);
-
- std::unique_ptr<FrameTimingTracker> tracker(
- FrameTimingTracker::Create(&host_impl));
- EXPECT_EQ("{\"values\":[]}",
- CompositeToString(tracker->GroupCompositeCountsByRectId()));
- EXPECT_EQ("{\"values\":[]}",
- MainFrameToString(tracker->GroupMainFrameCountsByRectId()));
-}
-
-TEST(FrameTimingTrackerTest, NoFrameIdsIsEmpty) {
- FakeImplTaskRunnerProvider task_runner_provider;
- TestSharedBitmapManager shared_bitmap_manager;
- TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
- &task_graph_runner);
-
- std::unique_ptr<FrameTimingTracker> tracker(
- FrameTimingTracker::Create(&host_impl));
- std::vector<std::pair<int, int64_t>> ids;
- tracker->SaveTimeStamps(base::TimeTicks::FromInternalValue(100), ids);
- EXPECT_EQ("{\"values\":[]}",
- CompositeToString(tracker->GroupCompositeCountsByRectId()));
-}
-
-TEST(FrameTimingTrackerTest, NoRectIdsYieldsNoMainFrameEvents) {
- FakeImplTaskRunnerProvider task_runner_provider;
- TestSharedBitmapManager shared_bitmap_manager;
- TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
- &task_graph_runner);
-
- std::unique_ptr<FrameTimingTracker> tracker(
- FrameTimingTracker::Create(&host_impl));
- tracker->SaveMainFrameTimeStamps(std::vector<int64_t>(),
- base::TimeTicks::FromInternalValue(100),
- base::TimeTicks::FromInternalValue(110), 1);
- EXPECT_EQ("{\"values\":[]}",
- MainFrameToString(tracker->GroupMainFrameCountsByRectId()));
-}
-
-TEST(FrameTimingTrackerTest, OneFrameId) {
- FakeImplTaskRunnerProvider task_runner_provider;
- TestSharedBitmapManager shared_bitmap_manager;
- TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
- &task_graph_runner);
-
- std::unique_ptr<FrameTimingTracker> tracker(
- FrameTimingTracker::Create(&host_impl));
- std::vector<std::pair<int, int64_t>> ids;
- ids.push_back(std::make_pair(1, 2));
- tracker->SaveTimeStamps(base::TimeTicks::FromInternalValue(100), ids);
- EXPECT_EQ(
- "{\"values\":[{\"events\":["
- "{\"frame_id\":1,\"timestamp\":100}],\"rect_id\":2}]}",
- CompositeToString(tracker->GroupCompositeCountsByRectId()));
-}
-
-TEST(FrameTimingTrackerTest, OneMainFrameRect) {
- FakeImplTaskRunnerProvider task_runner_provider;
- TestSharedBitmapManager shared_bitmap_manager;
- TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
- &task_graph_runner);
-
- std::unique_ptr<FrameTimingTracker> tracker(
- FrameTimingTracker::Create(&host_impl));
- std::vector<int64_t> rect_ids;
- rect_ids.push_back(1);
- tracker->SaveMainFrameTimeStamps(rect_ids,
- base::TimeTicks::FromInternalValue(100),
- base::TimeTicks::FromInternalValue(110), 2);
- EXPECT_EQ(
- "{\"values\":[{\"events\":["
- "{\"end_time\":110,\"frame_id\":2,\"timestamp\":100}],\"rect_id\":1}]}",
- MainFrameToString(tracker->GroupMainFrameCountsByRectId()));
-}
-
-TEST(FrameTimingTrackerTest, UnsortedTimestampsIds) {
- FakeImplTaskRunnerProvider task_runner_provider;
- TestSharedBitmapManager shared_bitmap_manager;
- TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
- &task_graph_runner);
-
- std::unique_ptr<FrameTimingTracker> tracker(
- FrameTimingTracker::Create(&host_impl));
- std::vector<std::pair<int, int64_t>> ids;
- ids.push_back(std::make_pair(1, 2));
- tracker->SaveTimeStamps(base::TimeTicks::FromInternalValue(200), ids);
- tracker->SaveTimeStamps(base::TimeTicks::FromInternalValue(400), ids);
- tracker->SaveTimeStamps(base::TimeTicks::FromInternalValue(100), ids);
- EXPECT_EQ(
- "{\"values\":[{\"events\":["
- "{\"frame_id\":1,\"timestamp\":100},"
- "{\"frame_id\":1,\"timestamp\":200},"
- "{\"frame_id\":1,\"timestamp\":400}],\"rect_id\":2}]}",
- CompositeToString(tracker->GroupCompositeCountsByRectId()));
-}
-
-TEST(FrameTimingTrackerTest, MainFrameUnsortedTimestamps) {
- FakeImplTaskRunnerProvider task_runner_provider;
- TestSharedBitmapManager shared_bitmap_manager;
- TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
- &task_graph_runner);
-
- std::unique_ptr<FrameTimingTracker> tracker(
- FrameTimingTracker::Create(&host_impl));
- std::vector<int64_t> rect_ids;
- rect_ids.push_back(2);
- tracker->SaveMainFrameTimeStamps(rect_ids,
- base::TimeTicks::FromInternalValue(200),
- base::TimeTicks::FromInternalValue(280), 1);
- tracker->SaveMainFrameTimeStamps(rect_ids,
- base::TimeTicks::FromInternalValue(400),
- base::TimeTicks::FromInternalValue(470), 1);
- tracker->SaveMainFrameTimeStamps(rect_ids,
- base::TimeTicks::FromInternalValue(100),
- base::TimeTicks::FromInternalValue(160), 1);
- EXPECT_EQ(
- "{\"values\":[{\"events\":["
- "{\"end_time\":160,\"frame_id\":1,\"timestamp\":100},"
- "{\"end_time\":280,\"frame_id\":1,\"timestamp\":200},"
- "{\"end_time\":470,\"frame_id\":1,\"timestamp\":400}],\"rect_id\":2}]}",
- MainFrameToString(tracker->GroupMainFrameCountsByRectId()));
-}
-
-TEST(FrameTimingTrackerTest, MultipleFrameIds) {
- FakeImplTaskRunnerProvider task_runner_provider;
- TestSharedBitmapManager shared_bitmap_manager;
- TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
- &task_graph_runner);
-
- std::unique_ptr<FrameTimingTracker> tracker(
- FrameTimingTracker::Create(&host_impl));
-
- std::vector<std::pair<int, int64_t>> ids200;
- ids200.push_back(std::make_pair(1, 2));
- ids200.push_back(std::make_pair(1, 3));
- tracker->SaveTimeStamps(base::TimeTicks::FromInternalValue(200), ids200);
-
- std::vector<std::pair<int, int64_t>> ids400;
- ids400.push_back(std::make_pair(2, 2));
- tracker->SaveTimeStamps(base::TimeTicks::FromInternalValue(400), ids400);
-
- std::vector<std::pair<int, int64_t>> ids100;
- ids100.push_back(std::make_pair(3, 2));
- ids100.push_back(std::make_pair(2, 3));
- ids100.push_back(std::make_pair(3, 4));
- tracker->SaveTimeStamps(base::TimeTicks::FromInternalValue(100), ids100);
-
- EXPECT_EQ(
- "{\"values\":[{\"events\":["
- "{\"frame_id\":3,\"timestamp\":100},"
- "{\"frame_id\":1,\"timestamp\":200},"
- "{\"frame_id\":2,\"timestamp\":400}],\"rect_id\":2},"
- "{\"events\":["
- "{\"frame_id\":2,\"timestamp\":100},"
- "{\"frame_id\":1,\"timestamp\":200}],\"rect_id\":3},"
- "{\"events\":["
- "{\"frame_id\":3,\"timestamp\":100}],\"rect_id\":4}"
- "]}",
- CompositeToString(tracker->GroupCompositeCountsByRectId()));
-}
-
-TEST(FrameTimingTrackerTest, MultipleMainFrameEvents) {
- FakeImplTaskRunnerProvider task_runner_provider;
- TestSharedBitmapManager shared_bitmap_manager;
- TestTaskGraphRunner task_graph_runner;
- FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
- &task_graph_runner);
-
- std::unique_ptr<FrameTimingTracker> tracker(
- FrameTimingTracker::Create(&host_impl));
-
- std::vector<int64_t> rect_ids200;
- rect_ids200.push_back(2);
- rect_ids200.push_back(3);
- tracker->SaveMainFrameTimeStamps(rect_ids200,
- base::TimeTicks::FromInternalValue(200),
- base::TimeTicks::FromInternalValue(220), 1);
-
- std::vector<int64_t> rect_ids400;
- rect_ids400.push_back(2);
- tracker->SaveMainFrameTimeStamps(rect_ids400,
- base::TimeTicks::FromInternalValue(400),
- base::TimeTicks::FromInternalValue(440), 2);
-
- std::vector<int64_t> rect_ids100;
- rect_ids100.push_back(2);
- rect_ids100.push_back(3);
- rect_ids100.push_back(4);
- tracker->SaveMainFrameTimeStamps(rect_ids100,
- base::TimeTicks::FromInternalValue(100),
- base::TimeTicks::FromInternalValue(110), 3);
-
- EXPECT_EQ(
- "{\"values\":[{\"events\":["
- "{\"end_time\":110,\"frame_id\":3,\"timestamp\":100},"
- "{\"end_time\":220,\"frame_id\":1,\"timestamp\":200},"
- "{\"end_time\":440,\"frame_id\":2,\"timestamp\":400}],\"rect_id\":2},"
- "{\"events\":["
- "{\"end_time\":110,\"frame_id\":3,\"timestamp\":100},"
- "{\"end_time\":220,\"frame_id\":1,\"timestamp\":200}],\"rect_id\":3},"
- "{\"events\":["
- "{\"end_time\":110,\"frame_id\":3,\"timestamp\":100}],\"rect_id\":4}"
- "]}",
- MainFrameToString(tracker->GroupMainFrameCountsByRectId()));
-}
-
-} // namespace
-} // namespace cc
« no previous file with comments | « cc/debug/frame_timing_tracker.cc ('k') | cc/layers/layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698