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

Side by Side Diff: cc/test/layer_tree_json_parser_unittest.cc

Issue 774763004: Use EXPECT_EQ when possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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/test/geometry_test_utils.h ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "cc/test/layer_tree_json_parser.h" 5 #include "cc/test/layer_tree_json_parser.h"
6 6
7 #include "cc/layers/layer.h" 7 #include "cc/layers/layer.h"
8 #include "cc/test/fake_impl_proxy.h" 8 #include "cc/test/fake_impl_proxy.h"
9 #include "cc/test/fake_layer_tree_host.h" 9 #include "cc/test/fake_layer_tree_host.h"
10 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
11 #include "cc/test/geometry_test_utils.h" 11 #include "cc/test/geometry_test_utils.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 namespace cc { 14 namespace cc {
15 15
16 namespace { 16 namespace {
17 17
18 bool LayerTreesMatch(LayerImpl* const layer_impl, 18 bool LayerTreesMatch(LayerImpl* const layer_impl,
19 Layer* const layer) { 19 Layer* const layer) {
20 #define RETURN_IF_EXPECTATION_FAILS(exp) \ 20 #define RETURN_IF_EXPECTATION_FAILS(exp) \
21 do { \ 21 do { \
22 exp; \ 22 exp; \
23 if (testing::UnitTest::GetInstance()->current_test_info()-> \ 23 if (testing::UnitTest::GetInstance()->current_test_info()-> \
24 result()->Failed()) \ 24 result()->Failed()) \
25 return false; \ 25 return false; \
26 } while (0) 26 } while (0)
27 27
28 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->children().size(), 28 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->children().size(),
29 layer->children().size())); 29 layer->children().size()));
30 RETURN_IF_EXPECTATION_FAILS(EXPECT_SIZE_EQ(layer_impl->bounds(), 30 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->bounds(), layer->bounds()));
31 layer->bounds())); 31 RETURN_IF_EXPECTATION_FAILS(
32 RETURN_IF_EXPECTATION_FAILS(EXPECT_POINT_EQ(layer_impl->position(), 32 EXPECT_EQ(layer_impl->position(), layer->position()));
33 layer->position()));
34 RETURN_IF_EXPECTATION_FAILS( 33 RETURN_IF_EXPECTATION_FAILS(
35 EXPECT_TRANSFORMATION_MATRIX_EQ(layer_impl->draw_transform(), 34 EXPECT_TRANSFORMATION_MATRIX_EQ(layer_impl->draw_transform(),
36 layer->draw_transform())); 35 layer->draw_transform()));
37 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->contents_opaque(), 36 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->contents_opaque(),
38 layer->contents_opaque())); 37 layer->contents_opaque()));
39 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->scrollable(), 38 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->scrollable(),
40 layer->scrollable())); 39 layer->scrollable()));
41 RETURN_IF_EXPECTATION_FAILS(EXPECT_FLOAT_EQ(layer_impl->opacity(), 40 RETURN_IF_EXPECTATION_FAILS(EXPECT_FLOAT_EQ(layer_impl->opacity(),
42 layer->opacity())); 41 layer->opacity()));
43 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->have_wheel_event_handlers(), 42 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->have_wheel_event_handlers(),
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 root_impl->AddChild(touch_layer.Pass()); 111 root_impl->AddChild(touch_layer.Pass());
113 tree->SetRootLayer(root_impl.Pass()); 112 tree->SetRootLayer(root_impl.Pass());
114 113
115 std::string json = host_impl.LayerTreeAsJson(); 114 std::string json = host_impl.LayerTreeAsJson();
116 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL); 115 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL);
117 ASSERT_TRUE(root.get()); 116 ASSERT_TRUE(root.get());
118 EXPECT_TRUE(LayerTreesMatch(host_impl.RootLayer(), root.get())); 117 EXPECT_TRUE(LayerTreesMatch(host_impl.RootLayer(), root.get()));
119 } 118 }
120 119
121 } // namespace cc 120 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/geometry_test_utils.h ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698