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

Unified Diff: cc/debug/rendering_stats_unittest.cc

Issue 421183003: Revert of Add builders for tracing event's structural arguments (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
« no previous file with comments | « cc/debug/rendering_stats.cc ('k') | cc/debug/traced_picture.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/debug/rendering_stats_unittest.cc
diff --git a/cc/debug/rendering_stats_unittest.cc b/cc/debug/rendering_stats_unittest.cc
index a634093237139511ec723cd8c83c7027787f1d46..ea0276c4de4cc9b70c457a5d6f539e323ecab696 100644
--- a/cc/debug/rendering_stats_unittest.cc
+++ b/cc/debug/rendering_stats_unittest.cc
@@ -1,8 +1,6 @@
// Copyright 2014 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 <string>
#include "base/time/time.h"
#include "base/values.h"
@@ -12,18 +10,20 @@
namespace cc {
namespace {
-static std::string ToString(const RenderingStats::TimeDeltaList& list) {
- scoped_refptr<base::debug::TracedValue> value =
- new base::debug::TracedValue();
- value->BeginArray("list_value");
- list.AddToTracedValue(value.get());
- value->EndArray();
- return value->ToString();
+void CompareDoubleValue(const base::ListValue& list_value,
+ int index,
+ double expected_value) {
+ double value;
+ EXPECT_TRUE(list_value.GetDouble(index, &value));
+ EXPECT_EQ(expected_value, value);
}
TEST(RenderingStatsTest, TimeDeltaListEmpty) {
RenderingStats::TimeDeltaList time_delta_list;
- EXPECT_EQ("{\"list_value\":[]}", ToString(time_delta_list));
+ scoped_ptr<base::ListValue> list_value =
+ time_delta_list.AsListValueInMilliseconds();
+ EXPECT_TRUE(list_value->empty());
+ EXPECT_EQ(0ul, list_value->GetSize());
}
TEST(RenderingStatsTest, TimeDeltaListNonEmpty) {
@@ -31,7 +31,13 @@
time_delta_list.Append(base::TimeDelta::FromMilliseconds(234));
time_delta_list.Append(base::TimeDelta::FromMilliseconds(827));
- EXPECT_EQ("{\"list_value\":[234.0,827.0]}", ToString(time_delta_list));
+ scoped_ptr<base::ListValue> list_value =
+ time_delta_list.AsListValueInMilliseconds();
+ EXPECT_FALSE(list_value->empty());
+ EXPECT_EQ(2ul, list_value->GetSize());
+
+ CompareDoubleValue(*list_value.get(), 0, 234);
+ CompareDoubleValue(*list_value.get(), 1, 827);
}
TEST(RenderingStatsTest, TimeDeltaListAdd) {
@@ -45,8 +51,16 @@
time_delta_list_b.Append(base::TimeDelta::FromMilliseconds(2));
time_delta_list_a.Add(time_delta_list_b);
- EXPECT_EQ("{\"list_value\":[810.0,32.0,43.0,938.0,2.0]}",
- ToString(time_delta_list_a));
+ scoped_ptr<base::ListValue> list_value =
+ time_delta_list_a.AsListValueInMilliseconds();
+ EXPECT_FALSE(list_value->empty());
+ EXPECT_EQ(5ul, list_value->GetSize());
+
+ CompareDoubleValue(*list_value.get(), 0, 810);
+ CompareDoubleValue(*list_value.get(), 1, 32);
+ CompareDoubleValue(*list_value.get(), 2, 43);
+ CompareDoubleValue(*list_value.get(), 3, 938);
+ CompareDoubleValue(*list_value.get(), 4, 2);
}
} // namespace
« no previous file with comments | « cc/debug/rendering_stats.cc ('k') | cc/debug/traced_picture.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698