| 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 "core/dom/CSSSelectorWatch.h" |   5 #include "core/dom/CSSSelectorWatch.h" | 
|   6  |   6  | 
|   7 #include "core/dom/Document.h" |   7 #include "core/dom/Document.h" | 
|   8 #include "core/dom/StyleEngine.h" |   8 #include "core/dom/StyleEngine.h" | 
|   9 #include "core/frame/FrameView.h" |   9 #include "core/frame/FrameView.h" | 
|  10 #include "core/html/HTMLElement.h" |  10 #include "core/html/HTMLElement.h" | 
|  11 #include "core/testing/DummyPageHolder.h" |  11 #include "core/testing/DummyPageHolder.h" | 
|  12 #include "testing/gtest/include/gtest/gtest.h" |  12 #include "testing/gtest/include/gtest/gtest.h" | 
 |  13 #include <memory> | 
|  13  |  14  | 
|  14 namespace blink { |  15 namespace blink { | 
|  15  |  16  | 
|  16 class CSSSelectorWatchTest : public ::testing::Test { |  17 class CSSSelectorWatchTest : public ::testing::Test { | 
|  17 protected: |  18 protected: | 
|  18     void SetUp() override; |  19     void SetUp() override; | 
|  19  |  20  | 
|  20     Document& document() { return m_dummyPageHolder->document(); } |  21     Document& document() { return m_dummyPageHolder->document(); } | 
|  21     StyleEngine& styleEngine() { return document().styleEngine(); } |  22     StyleEngine& styleEngine() { return document().styleEngine(); } | 
|  22  |  23  | 
|  23     static const HashSet<String> addedSelectors(const CSSSelectorWatch& watch) {
     return watch.m_addedSelectors; } |  24     static const HashSet<String> addedSelectors(const CSSSelectorWatch& watch) {
     return watch.m_addedSelectors; } | 
|  24     static const HashSet<String> removedSelectors(const CSSSelectorWatch& watch)
     { return watch.m_removedSelectors; } |  25     static const HashSet<String> removedSelectors(const CSSSelectorWatch& watch)
     { return watch.m_removedSelectors; } | 
|  25     static void clearAddedRemoved(CSSSelectorWatch&); |  26     static void clearAddedRemoved(CSSSelectorWatch&); | 
|  26  |  27  | 
|  27 private: |  28 private: | 
|  28     OwnPtr<DummyPageHolder> m_dummyPageHolder; |  29     std::unique_ptr<DummyPageHolder> m_dummyPageHolder; | 
|  29 }; |  30 }; | 
|  30  |  31  | 
|  31 void CSSSelectorWatchTest::SetUp() |  32 void CSSSelectorWatchTest::SetUp() | 
|  32 { |  33 { | 
|  33     m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); |  34     m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); | 
|  34 } |  35 } | 
|  35  |  36  | 
|  36 void CSSSelectorWatchTest::clearAddedRemoved(CSSSelectorWatch& watch) |  37 void CSSSelectorWatchTest::clearAddedRemoved(CSSSelectorWatch& watch) | 
|  37 { |  38 { | 
|  38     watch.m_addedSelectors.clear(); |  39     watch.m_addedSelectors.clear(); | 
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  84     EXPECT_EQ(2u, afterCount - beforeCount); |  85     EXPECT_EQ(2u, afterCount - beforeCount); | 
|  85  |  86  | 
|  86     EXPECT_EQ(1u, addedSelectors(watch).size()); |  87     EXPECT_EQ(1u, addedSelectors(watch).size()); | 
|  87     EXPECT_TRUE(addedSelectors(watch).contains(".c")); |  88     EXPECT_TRUE(addedSelectors(watch).contains(".c")); | 
|  88  |  89  | 
|  89     EXPECT_EQ(1u, removedSelectors(watch).size()); |  90     EXPECT_EQ(1u, removedSelectors(watch).size()); | 
|  90     EXPECT_TRUE(removedSelectors(watch).contains(".b")); |  91     EXPECT_TRUE(removedSelectors(watch).contains(".b")); | 
|  91 } |  92 } | 
|  92  |  93  | 
|  93 } // namespace blink |  94 } // namespace blink | 
| OLD | NEW |