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

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

Issue 2078143002: Make plugin elements return false from canStartSelection. (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 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/Node.h" 5 #include "core/dom/Node.h"
6 6
7 #include "core/editing/EditingTestBase.h" 7 #include "core/editing/EditingTestBase.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 18 matching lines...) Expand all
29 const char* bodyContent = "<div id=host><span id=one>one</span></div>"; 29 const char* bodyContent = "<div id=host><span id=one>one</span></div>";
30 const char* shadowContent = "<a href='http://www.msn.com'><content></content ></a>"; 30 const char* shadowContent = "<a href='http://www.msn.com'><content></content ></a>";
31 setBodyContent(bodyContent); 31 setBodyContent(bodyContent);
32 setShadowContent(shadowContent, "host"); 32 setShadowContent(shadowContent, "host");
33 Node* one = document().getElementById("one"); 33 Node* one = document().getElementById("one");
34 34
35 EXPECT_FALSE(one->canStartSelection()); 35 EXPECT_FALSE(one->canStartSelection());
36 EXPECT_FALSE(one->firstChild()->canStartSelection()); 36 EXPECT_FALSE(one->firstChild()->canStartSelection());
37 } 37 }
38 38
39 TEST_F(NodeTest, canStartSelectionWithPlugin)
40 {
41 const char* bodyContent = "<embed id=one>";
42 setBodyContent(bodyContent);
43 Node* one = document().getElementById("one");
44
45 EXPECT_FALSE(one->canStartSelection());
46 }
47
39 TEST_F(NodeTest, customElementState) 48 TEST_F(NodeTest, customElementState)
40 { 49 {
41 const char* bodyContent = "<div id=div></div>"; 50 const char* bodyContent = "<div id=div></div>";
42 setBodyContent(bodyContent); 51 setBodyContent(bodyContent);
43 Element* div = document().getElementById("div"); 52 Element* div = document().getElementById("div");
44 EXPECT_EQ(CustomElementState::Uncustomized, div->getCustomElementState()); 53 EXPECT_EQ(CustomElementState::Uncustomized, div->getCustomElementState());
45 EXPECT_TRUE(div->isDefined()); 54 EXPECT_TRUE(div->isDefined());
46 EXPECT_EQ(Node::V0NotCustomElement, div->getV0CustomElementState()); 55 EXPECT_EQ(Node::V0NotCustomElement, div->getV0CustomElementState());
47 56
48 div->setCustomElementState(CustomElementState::Undefined); 57 div->setCustomElementState(CustomElementState::Undefined);
49 EXPECT_EQ(CustomElementState::Undefined, div->getCustomElementState()); 58 EXPECT_EQ(CustomElementState::Undefined, div->getCustomElementState());
50 EXPECT_FALSE(div->isDefined()); 59 EXPECT_FALSE(div->isDefined());
51 EXPECT_EQ(Node::V0NotCustomElement, div->getV0CustomElementState()); 60 EXPECT_EQ(Node::V0NotCustomElement, div->getV0CustomElementState());
52 61
53 div->setCustomElementState(CustomElementState::Custom); 62 div->setCustomElementState(CustomElementState::Custom);
54 EXPECT_EQ(CustomElementState::Custom, div->getCustomElementState()); 63 EXPECT_EQ(CustomElementState::Custom, div->getCustomElementState());
55 EXPECT_TRUE(div->isDefined()); 64 EXPECT_TRUE(div->isDefined());
56 EXPECT_EQ(Node::V0NotCustomElement, div->getV0CustomElementState()); 65 EXPECT_EQ(Node::V0NotCustomElement, div->getV0CustomElementState());
57 } 66 }
58 67
59 } // namespace blink 68 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698