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 "modules/credentialmanager/PasswordCredential.h" | 5 #include "modules/credentialmanager/PasswordCredential.h" |
6 | 6 |
7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
8 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 8 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
9 #include "core/dom/ExceptionCode.h" | 9 #include "core/dom/ExceptionCode.h" |
10 #include "core/dom/URLSearchParams.h" | 10 #include "core/dom/URLSearchParams.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 { | 25 { |
26 m_dummyPageHolder = DummyPageHolder::create(); | 26 m_dummyPageHolder = DummyPageHolder::create(); |
27 m_document = toHTMLDocument(&m_dummyPageHolder->document()); | 27 m_document = toHTMLDocument(&m_dummyPageHolder->document()); |
28 } | 28 } |
29 | 29 |
30 HTMLDocument& document() const { return *m_document; } | 30 HTMLDocument& document() const { return *m_document; } |
31 | 31 |
32 HTMLFormElement* populateForm(const char* enctype, const char* html) | 32 HTMLFormElement* populateForm(const char* enctype, const char* html) |
33 { | 33 { |
34 StringBuilder b; | 34 StringBuilder b; |
35 b.append("<!DOCTYPE html><html><body><form id='theForm' enctype='"); | 35 b.appendLiteral("<!DOCTYPE html><html><body><form id='theForm' enctype='
"); |
36 b.append(enctype); | 36 b.append(enctype); |
37 b.append("'>"); | 37 b.appendLiteral("'>"); |
38 b.append(html); | 38 b.append(html); |
39 b.append("</form></body></html>"); | 39 b.appendLiteral("</form></body></html>"); |
40 document().documentElement()->setInnerHTML(b.toString(), ASSERT_NO_EXCEP
TION); | 40 document().documentElement()->setInnerHTML(b.toString(), ASSERT_NO_EXCEP
TION); |
41 document().view()->updateAllLifecyclePhases(); | 41 document().view()->updateAllLifecyclePhases(); |
42 HTMLFormElement* form = toHTMLFormElement(document().getElementById("the
Form")); | 42 HTMLFormElement* form = toHTMLFormElement(document().getElementById("the
Form")); |
43 EXPECT_NE(nullptr, form); | 43 EXPECT_NE(nullptr, form); |
44 return form; | 44 return form; |
45 } | 45 } |
46 | 46 |
47 private: | 47 private: |
48 OwnPtr<DummyPageHolder> m_dummyPageHolder; | 48 OwnPtr<DummyPageHolder> m_dummyPageHolder; |
49 Persistent<HTMLDocument> m_document; | 49 Persistent<HTMLDocument> m_document; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 "<input type='text' name='theName' value='friendly name' autocomplete='n
ame'>"); | 131 "<input type='text' name='theName' value='friendly name' autocomplete='n
ame'>"); |
132 TrackExceptionState exceptionState; | 132 TrackExceptionState exceptionState; |
133 PasswordCredential* credential = PasswordCredential::create(form, exceptionS
tate); | 133 PasswordCredential* credential = PasswordCredential::create(form, exceptionS
tate); |
134 EXPECT_EQ(nullptr, credential); | 134 EXPECT_EQ(nullptr, credential); |
135 EXPECT_TRUE(exceptionState.hadException()); | 135 EXPECT_TRUE(exceptionState.hadException()); |
136 EXPECT_EQ(V8TypeError, exceptionState.code()); | 136 EXPECT_EQ(V8TypeError, exceptionState.code()); |
137 EXPECT_EQ("'id' must not be empty.", exceptionState.message()); | 137 EXPECT_EQ("'id' must not be empty.", exceptionState.message()); |
138 } | 138 } |
139 | 139 |
140 } // namespace blink | 140 } // namespace blink |
OLD | NEW |