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

Side by Side Diff: cc/debug/rendering_stats_unittest.cc

Issue 898663003: cc: refactor of RenderingStats::TimeDeltaList::AddToTracedValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « cc/debug/rendering_stats.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 5 #include <string>
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "cc/debug/rendering_stats.h" 9 #include "cc/debug/rendering_stats.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace cc { 12 namespace cc {
13 namespace { 13 namespace {
14 14
15 static std::string ToString(const RenderingStats::TimeDeltaList& list) { 15 static std::string ToString(const RenderingStats::TimeDeltaList& list) {
16 scoped_refptr<base::debug::TracedValue> value = 16 scoped_refptr<base::debug::TracedValue> value =
17 new base::debug::TracedValue(); 17 new base::debug::TracedValue();
18 value->BeginArray("list_value"); 18 list.AddToTracedValue("list_value", value.get());
19 list.AddToTracedValue(value.get());
20 value->EndArray();
21 return value->ToString(); 19 return value->ToString();
22 } 20 }
23 21
24 TEST(RenderingStatsTest, TimeDeltaListEmpty) { 22 TEST(RenderingStatsTest, TimeDeltaListEmpty) {
25 RenderingStats::TimeDeltaList time_delta_list; 23 RenderingStats::TimeDeltaList time_delta_list;
26 EXPECT_EQ("{\"list_value\":[]}", ToString(time_delta_list)); 24 EXPECT_EQ("{\"list_value\":[]}", ToString(time_delta_list));
27 } 25 }
28 26
29 TEST(RenderingStatsTest, TimeDeltaListNonEmpty) { 27 TEST(RenderingStatsTest, TimeDeltaListNonEmpty) {
30 RenderingStats::TimeDeltaList time_delta_list; 28 RenderingStats::TimeDeltaList time_delta_list;
(...skipping 13 matching lines...) Expand all
44 time_delta_list_b.Append(base::TimeDelta::FromMilliseconds(938)); 42 time_delta_list_b.Append(base::TimeDelta::FromMilliseconds(938));
45 time_delta_list_b.Append(base::TimeDelta::FromMilliseconds(2)); 43 time_delta_list_b.Append(base::TimeDelta::FromMilliseconds(2));
46 44
47 time_delta_list_a.Add(time_delta_list_b); 45 time_delta_list_a.Add(time_delta_list_b);
48 EXPECT_EQ("{\"list_value\":[810.0,32.0,43.0,938.0,2.0]}", 46 EXPECT_EQ("{\"list_value\":[810.0,32.0,43.0,938.0,2.0]}",
49 ToString(time_delta_list_a)); 47 ToString(time_delta_list_a));
50 } 48 }
51 49
52 } // namespace 50 } // namespace
53 } // namespace cc 51 } // namespace cc
OLDNEW
« no previous file with comments | « cc/debug/rendering_stats.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698