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

Side by Side Diff: Source/core/editing/SurroundingTextTest.cpp

Issue 1171323003: Fix unit test style in core/{dom,editing,html}/. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: whitespace fix Created 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 #include "core/editing/SurroundingText.h" 6 #include "core/editing/SurroundingText.h"
7 7
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/Position.h" 9 #include "core/dom/Position.h"
10 #include "core/dom/Range.h" 10 #include "core/dom/Range.h"
11 #include "core/dom/Text.h" 11 #include "core/dom/Text.h"
12 #include "core/editing/VisibleSelection.h" 12 #include "core/editing/VisibleSelection.h"
13 #include "core/html/HTMLElement.h" 13 #include "core/html/HTMLElement.h"
14 #include "core/testing/DummyPageHolder.h" 14 #include "core/testing/DummyPageHolder.h"
15 #include <gtest/gtest.h> 15 #include <gtest/gtest.h>
16 16
17 using namespace blink; 17 namespace blink {
18
19 namespace {
20 18
21 class SurroundingTextTest : public ::testing::Test { 19 class SurroundingTextTest : public ::testing::Test {
22 protected: 20 protected:
23 Document& document() const { return m_dummyPageHolder->document(); } 21 Document& document() const { return m_dummyPageHolder->document(); }
24 void setHTML(const String&); 22 void setHTML(const String&);
25 VisibleSelection select(int offset) { return select(offset, offset); } 23 VisibleSelection select(int offset) { return select(offset, offset); }
26 VisibleSelection select(int start, int end); 24 VisibleSelection select(int start, int end);
27 25
28 private: 26 private:
29 virtual void SetUp() override; 27 void SetUp() override;
30 28
31 OwnPtr<DummyPageHolder> m_dummyPageHolder; 29 OwnPtr<DummyPageHolder> m_dummyPageHolder;
32 }; 30 };
33 31
34 void SurroundingTextTest::SetUp() 32 void SurroundingTextTest::SetUp()
35 { 33 {
36 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); 34 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600));
37 } 35 }
38 36
39 void SurroundingTextTest::setHTML(const String& content) 37 void SurroundingTextTest::setHTML(const String& content)
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 { 253 {
256 VisibleSelection selection = select(0, 7); 254 VisibleSelection selection = select(0, 7);
257 SurroundingText surroundingText(*selection.firstRange(), 1337); 255 SurroundingText surroundingText(*selection.firstRange(), 1337);
258 256
259 EXPECT_EQ("This is outside of foo bar the selected node", surroundingTex t.content().simplifyWhiteSpace()); 257 EXPECT_EQ("This is outside of foo bar the selected node", surroundingTex t.content().simplifyWhiteSpace());
260 EXPECT_EQ(20u, surroundingText.startOffsetInContent()); 258 EXPECT_EQ(20u, surroundingText.startOffsetInContent());
261 EXPECT_EQ(27u, surroundingText.endOffsetInContent()); 259 EXPECT_EQ(27u, surroundingText.endOffsetInContent());
262 } 260 }
263 } 261 }
264 262
265 } // anonymous namespace 263 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/StyledMarkupSerializerTest.cpp ('k') | Source/core/editing/VisibleSelectionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698