| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "core/dom/NthIndexCache.h" | 5 #include "core/dom/NthIndexCache.h" |
| 6 | 6 |
| 7 #include <memory> |
| 7 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 8 #include "core/html/HTMLElement.h" | 9 #include "core/html/HTMLElement.h" |
| 9 #include "core/testing/DummyPageHolder.h" | 10 #include "core/testing/DummyPageHolder.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include <memory> | |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class NthIndexCacheTest : public ::testing::Test { | 15 class NthIndexCacheTest : public ::testing::Test { |
| 16 protected: | 16 protected: |
| 17 void SetUp() override; | 17 void SetUp() override; |
| 18 | 18 |
| 19 Document& GetDocument() const { return dummy_page_holder_->GetDocument(); } | 19 Document& GetDocument() const { return dummy_page_holder_->GetDocument(); } |
| 20 void SetHtmlInnerHTML(const char* html_content); | 20 void SetHtmlInnerHTML(const char* html_content); |
| 21 | 21 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 45 | 45 |
| 46 EXPECT_EQ( | 46 EXPECT_EQ( |
| 47 nth_index_cache.NthChildIndex(*GetDocument().getElementById("nth-child")), | 47 nth_index_cache.NthChildIndex(*GetDocument().getElementById("nth-child")), |
| 48 12U); | 48 12U); |
| 49 EXPECT_EQ(nth_index_cache.NthLastChildIndex( | 49 EXPECT_EQ(nth_index_cache.NthLastChildIndex( |
| 50 *GetDocument().getElementById("nth-last-child")), | 50 *GetDocument().getElementById("nth-last-child")), |
| 51 12U); | 51 12U); |
| 52 } | 52 } |
| 53 | 53 |
| 54 } // namespace blink | 54 } // namespace blink |
| OLD | NEW |