| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "platform/graphics/CompositorElementId.h" | 5 #include "platform/graphics/CompositorElementId.h" |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| 11 class CompositorElementIdTest : public ::testing::Test {}; | 11 class CompositorElementIdTest : public ::testing::Test {}; |
| 12 | 12 |
| 13 TEST_F(CompositorElementIdTest, EncodeDecode) { | 13 TEST_F(CompositorElementIdTest, EncodeDecode) { |
| 14 CompositorElementId element_id = | 14 CompositorElementId element_id = CompositorElementIdFromDOMNodeId( |
| 15 CreateCompositorElementId(1, CompositorSubElementId::kPrimary); | 15 1, CompositorElementIdNamespace::kPrimary); |
| 16 EXPECT_EQ(1u, DomNodeIdFromCompositorElementId(element_id)); | 16 EXPECT_EQ(1u, IdFromCompositorElementId(element_id)); |
| 17 EXPECT_EQ(CompositorSubElementId::kPrimary, | 17 EXPECT_EQ(CompositorElementIdNamespace::kPrimary, |
| 18 SubElementIdFromCompositorElementId(element_id)); | 18 NamespaceFromCompositorElementId(element_id)); |
| 19 | 19 |
| 20 element_id = | 20 element_id = CompositorElementIdFromDOMNodeId( |
| 21 CreateCompositorElementId(1, CompositorSubElementId::kLinkHighlight); | 21 1, CompositorElementIdNamespace::kLinkHighlight); |
| 22 EXPECT_EQ(1u, DomNodeIdFromCompositorElementId(element_id)); | 22 EXPECT_EQ(1u, IdFromCompositorElementId(element_id)); |
| 23 EXPECT_EQ(CompositorSubElementId::kLinkHighlight, | 23 EXPECT_EQ(CompositorElementIdNamespace::kLinkHighlight, |
| 24 SubElementIdFromCompositorElementId(element_id)); | 24 NamespaceFromCompositorElementId(element_id)); |
| 25 | 25 |
| 26 element_id = CreateCompositorElementId(23, CompositorSubElementId::kScroll); | 26 element_id = CompositorElementIdFromDOMNodeId( |
| 27 EXPECT_EQ(23u, DomNodeIdFromCompositorElementId(element_id)); | 27 23, CompositorElementIdNamespace::kScroll); |
| 28 EXPECT_EQ(CompositorSubElementId::kScroll, | 28 EXPECT_EQ(23u, IdFromCompositorElementId(element_id)); |
| 29 SubElementIdFromCompositorElementId(element_id)); | 29 EXPECT_EQ(CompositorElementIdNamespace::kScroll, |
| 30 NamespaceFromCompositorElementId(element_id)); |
| 30 } | 31 } |
| 31 | 32 |
| 32 } // namespace blink | 33 } // namespace blink |
| OLD | NEW |