mac: Don't limit GL_MAX_TEXTURE_SIZE on 10.9.0+.
[chromium-blink-merge.git] / cc / debug / rendering_stats_unittest.cc
bloba634093237139511ec723cd8c83c7027787f1d46
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
3 // found in the LICENSE file.
5 #include <string>
7 #include "base/time/time.h"
8 #include "base/values.h"
9 #include "cc/debug/rendering_stats.h"
10 #include "testing/gtest/include/gtest/gtest.h"
12 namespace cc {
13 namespace {
15 static std::string ToString(const RenderingStats::TimeDeltaList& list) {
16 scoped_refptr<base::debug::TracedValue> value =
17 new base::debug::TracedValue();
18 value->BeginArray("list_value");
19 list.AddToTracedValue(value.get());
20 value->EndArray();
21 return value->ToString();
24 TEST(RenderingStatsTest, TimeDeltaListEmpty) {
25 RenderingStats::TimeDeltaList time_delta_list;
26 EXPECT_EQ("{\"list_value\":[]}", ToString(time_delta_list));
29 TEST(RenderingStatsTest, TimeDeltaListNonEmpty) {
30 RenderingStats::TimeDeltaList time_delta_list;
31 time_delta_list.Append(base::TimeDelta::FromMilliseconds(234));
32 time_delta_list.Append(base::TimeDelta::FromMilliseconds(827));
34 EXPECT_EQ("{\"list_value\":[234.0,827.0]}", ToString(time_delta_list));
37 TEST(RenderingStatsTest, TimeDeltaListAdd) {
38 RenderingStats::TimeDeltaList time_delta_list_a;
39 time_delta_list_a.Append(base::TimeDelta::FromMilliseconds(810));
40 time_delta_list_a.Append(base::TimeDelta::FromMilliseconds(32));
42 RenderingStats::TimeDeltaList time_delta_list_b;
43 time_delta_list_b.Append(base::TimeDelta::FromMilliseconds(43));
44 time_delta_list_b.Append(base::TimeDelta::FromMilliseconds(938));
45 time_delta_list_b.Append(base::TimeDelta::FromMilliseconds(2));
47 time_delta_list_a.Add(time_delta_list_b);
48 EXPECT_EQ("{\"list_value\":[810.0,32.0,43.0,938.0,2.0]}",
49 ToString(time_delta_list_a));
52 } // namespace
53 } // namespace cc