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

Side by Side Diff: Source/core/html/HTMLFormElementTest.cpp

Issue 616443002: Implement :valid and :invalid pseudoclass for <form> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix the problem with shared element style Created 6 years, 2 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "core/html/HTMLFormElement.h"
7
8 #include "core/frame/FrameView.h"
9 #include "core/html/HTMLDocument.h"
10 #include "core/html/HTMLInputElement.h"
11 #include "core/loader/EmptyClients.h"
12 #include "core/testing/DummyPageHolder.h"
13 #include <gtest/gtest.h>
14
15 namespace blink {
16
17 class HTMLFormElementTest : public ::testing::Test {
keishi 2014/10/01 09:25:28 In blink we try to write layout tests if possible
Bartek Nowierski 2014/10/02 14:26:43 Added a LayoutTests/fast/forms/form-pseudo-valid-s
18 protected:
19 virtual void SetUp() OVERRIDE;
20
21 DummyPageHolder& page() const { return *m_dummyPageHolder; }
22 HTMLDocument& document() const { return *m_document; }
23
24 private:
25 OwnPtr<DummyPageHolder> m_dummyPageHolder;
26 RefPtrWillBePersistent<HTMLDocument> m_document;
27 };
28
29 void HTMLFormElementTest::SetUp()
30 {
31 Page::PageClients pageClients;
32 fillWithEmptyClients(pageClients);
33 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600), &pageClients) ;
34
35 m_document = toHTMLDocument(&m_dummyPageHolder->document());
36 m_document->setMimeType("text/html");
37 m_document->setCharset("utf-8");
38 }
39
40 TEST_F(HTMLFormElementTest, isValidElement)
41 {
42 document().documentElement()->setInnerHTML(
43 "<body><form id=form1><input required><input required value=0></form>"
44 "<form id=form2><input><input required value=0></form>"
45 "<form id=form3></form></body>", ASSERT_NO_EXCEPTION);
46 document().view()->updateLayoutAndStyleIfNeededRecursive();
47
48 HTMLFormElement* form1 = toHTMLFormElement(document().getElementById("form1" ));
49 HTMLFormElement* form2 = toHTMLFormElement(document().getElementById("form2" ));
50 HTMLFormElement* form3 = toHTMLFormElement(document().getElementById("form3" ));
51
52 EXPECT_FALSE(form1->isValidElement());
53 EXPECT_TRUE(form2->isValidElement());
54 EXPECT_TRUE(form3->isValidElement());
55 }
56
57 }
OLDNEW
« Source/core/html/HTMLFormControlElementTest.cpp ('K') | « Source/core/html/HTMLFormElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698