OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/renderer/skia_benchmarking_extension.h" | 5 #include "content/renderer/skia_benchmarking_extension.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "third_party/skia/include/core/SkCanvas.h" | 8 #include "third_party/skia/include/core/SkCanvas.h" |
9 #include "third_party/skia/include/core/SkGraphics.h" | 9 #include "third_party/skia/include/core/SkGraphics.h" |
10 #include "third_party/skia/src/utils/debugger/SkDebugCanvas.h" | 10 #include "third_party/skia/src/utils/debugger/SkDebugCanvas.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 ASSERT_EQ(canvas.getSize(), 5); | 65 ASSERT_EQ(canvas.getSize(), 5); |
66 | 66 |
67 ASSERT_TRUE(canvas.getDrawCommandAt(idx) != NULL); | 67 ASSERT_TRUE(canvas.getDrawCommandAt(idx) != NULL); |
68 cmd = canvas.getDrawCommandAt(idx)->getType(); | 68 cmd = canvas.getDrawCommandAt(idx)->getType(); |
69 EXPECT_EQ(cmd, SkDrawCommand::kSave_OpType); | 69 EXPECT_EQ(cmd, SkDrawCommand::kSave_OpType); |
70 EXPECT_STREQ(SkDrawCommand::GetCommandString(cmd), "Save"); | 70 EXPECT_STREQ(SkDrawCommand::GetCommandString(cmd), "Save"); |
71 | 71 |
72 ASSERT_TRUE(canvas.getDrawCommandAt(++idx) != NULL); | 72 ASSERT_TRUE(canvas.getDrawCommandAt(++idx) != NULL); |
73 cmd = canvas.getDrawCommandAt(idx)->getType(); | 73 cmd = canvas.getDrawCommandAt(idx)->getType(); |
74 EXPECT_EQ(cmd, SkDrawCommand::kClipRect_OpType); | 74 EXPECT_EQ(cmd, SkDrawCommand::kClipRect_OpType); |
75 EXPECT_STREQ(SkDrawCommand::GetCommandString(cmd), | 75 EXPECT_STREQ(SkDrawCommand::GetCommandString(cmd), "ClipRect"); |
76 SkDrawCommand::kClipRectString); | |
77 EXPECT_TRUE(HasInfoField(canvas, idx, "SkRect")); | 76 EXPECT_TRUE(HasInfoField(canvas, idx, "SkRect")); |
78 EXPECT_TRUE(HasInfoField(canvas, idx, "Op")); | 77 EXPECT_TRUE(HasInfoField(canvas, idx, "Op")); |
79 EXPECT_TRUE(HasInfoField(canvas, idx, "doAA")); | 78 EXPECT_TRUE(HasInfoField(canvas, idx, "doAA")); |
80 | 79 |
81 ASSERT_TRUE(canvas.getDrawCommandAt(++idx) != NULL); | 80 ASSERT_TRUE(canvas.getDrawCommandAt(++idx) != NULL); |
82 cmd = canvas.getDrawCommandAt(idx)->getType(); | 81 cmd = canvas.getDrawCommandAt(idx)->getType(); |
83 EXPECT_EQ(cmd, SkDrawCommand::kSetMatrix_OpType); | 82 EXPECT_EQ(cmd, SkDrawCommand::kSetMatrix_OpType); |
84 EXPECT_STREQ(SkDrawCommand::GetCommandString(cmd), "SetMatrix"); | 83 EXPECT_STREQ(SkDrawCommand::GetCommandString(cmd), "SetMatrix"); |
85 | 84 |
86 ASSERT_TRUE(canvas.getDrawCommandAt(++idx) != NULL); | 85 ASSERT_TRUE(canvas.getDrawCommandAt(++idx) != NULL); |
87 cmd = canvas.getDrawCommandAt(idx)->getType(); | 86 cmd = canvas.getDrawCommandAt(idx)->getType(); |
88 EXPECT_EQ(cmd, SkDrawCommand::kDrawRect_OpType); | 87 EXPECT_EQ(cmd, SkDrawCommand::kDrawRect_OpType); |
89 EXPECT_STREQ(SkDrawCommand::GetCommandString(cmd), | 88 EXPECT_STREQ(SkDrawCommand::GetCommandString(cmd), "DrawRect"); |
90 SkDrawCommand::kDrawRectString); | |
91 EXPECT_TRUE(HasInfoField(canvas, idx, "SkRect")); | 89 EXPECT_TRUE(HasInfoField(canvas, idx, "SkRect")); |
92 | 90 |
93 ASSERT_TRUE(canvas.getDrawCommandAt(++idx) != NULL); | 91 ASSERT_TRUE(canvas.getDrawCommandAt(++idx) != NULL); |
94 cmd = canvas.getDrawCommandAt(idx)->getType(); | 92 cmd = canvas.getDrawCommandAt(idx)->getType(); |
95 EXPECT_EQ(cmd, SkDrawCommand::kRestore_OpType); | 93 EXPECT_EQ(cmd, SkDrawCommand::kRestore_OpType); |
96 EXPECT_STREQ(SkDrawCommand::GetCommandString(cmd), "Restore"); | 94 EXPECT_STREQ(SkDrawCommand::GetCommandString(cmd), "Restore"); |
97 } | 95 } |
98 | 96 |
99 } // namespace content | 97 } // namespace content |
OLD | NEW |