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

Side by Side Diff: third_party/WebKit/Source/core/dom/CSSSelectorWatchTest.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months 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
OLDNEW
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>
14 13
15 namespace blink { 14 namespace blink {
16 15
17 class CSSSelectorWatchTest : public ::testing::Test { 16 class CSSSelectorWatchTest : public ::testing::Test {
18 protected: 17 protected:
19 void SetUp() override; 18 void SetUp() override;
20 19
21 Document& document() { return m_dummyPageHolder->document(); } 20 Document& document() { return m_dummyPageHolder->document(); }
22 StyleEngine& styleEngine() { return document().styleEngine(); } 21 StyleEngine& styleEngine() { return document().styleEngine(); }
23 22
24 static const HashSet<String> addedSelectors(const CSSSelectorWatch& watch) { return watch.m_addedSelectors; } 23 static const HashSet<String> addedSelectors(const CSSSelectorWatch& watch) { return watch.m_addedSelectors; }
25 static const HashSet<String> removedSelectors(const CSSSelectorWatch& watch) { return watch.m_removedSelectors; } 24 static const HashSet<String> removedSelectors(const CSSSelectorWatch& watch) { return watch.m_removedSelectors; }
26 static void clearAddedRemoved(CSSSelectorWatch&); 25 static void clearAddedRemoved(CSSSelectorWatch&);
27 26
28 private: 27 private:
29 std::unique_ptr<DummyPageHolder> m_dummyPageHolder; 28 OwnPtr<DummyPageHolder> m_dummyPageHolder;
30 }; 29 };
31 30
32 void CSSSelectorWatchTest::SetUp() 31 void CSSSelectorWatchTest::SetUp()
33 { 32 {
34 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); 33 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600));
35 } 34 }
36 35
37 void CSSSelectorWatchTest::clearAddedRemoved(CSSSelectorWatch& watch) 36 void CSSSelectorWatchTest::clearAddedRemoved(CSSSelectorWatch& watch)
38 { 37 {
39 watch.m_addedSelectors.clear(); 38 watch.m_addedSelectors.clear();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 EXPECT_EQ(2u, afterCount - beforeCount); 84 EXPECT_EQ(2u, afterCount - beforeCount);
86 85
87 EXPECT_EQ(1u, addedSelectors(watch).size()); 86 EXPECT_EQ(1u, addedSelectors(watch).size());
88 EXPECT_TRUE(addedSelectors(watch).contains(".c")); 87 EXPECT_TRUE(addedSelectors(watch).contains(".c"));
89 88
90 EXPECT_EQ(1u, removedSelectors(watch).size()); 89 EXPECT_EQ(1u, removedSelectors(watch).size());
91 EXPECT_TRUE(removedSelectors(watch).contains(".b")); 90 EXPECT_TRUE(removedSelectors(watch).contains(".b"));
92 } 91 }
93 92
94 } // namespace blink 93 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698