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

Side by Side Diff: chrome/renderer/autofill/autofill_browsertest.cc

Issue 10408089: Update RenderViewTest::LoadHTML documentation, and remove spurious commits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remediate to review Created 8 years, 7 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
« no previous file with comments | « no previous file | chrome/renderer/translate_helper_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "chrome/common/autofill_messages.h" 6 #include "chrome/common/autofill_messages.h"
7 #include "chrome/test/base/chrome_render_view_test.h" 7 #include "chrome/test/base/chrome_render_view_test.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h"
(...skipping 22 matching lines...) Expand all
33 " <input type=\"text\" id=\"lastname\" autoComplete=\"off\"/>" 33 " <input type=\"text\" id=\"lastname\" autoComplete=\"off\"/>"
34 " <input type=\"hidden\" id=\"email\"/>" 34 " <input type=\"hidden\" id=\"email\"/>"
35 " <select id=\"state\"/>" 35 " <select id=\"state\"/>"
36 " <option>?</option>" 36 " <option>?</option>"
37 " <option>California</option>" 37 " <option>California</option>"
38 " <option>Texas</option>" 38 " <option>Texas</option>"
39 " </select>" 39 " </select>"
40 "</form>"); 40 "</form>");
41 41
42 // Verify that "FormsSeen" sends the expected number of fields. 42 // Verify that "FormsSeen" sends the expected number of fields.
43 ProcessPendingMessages();
44 const IPC::Message* message = render_thread_->sink().GetFirstMessageMatching( 43 const IPC::Message* message = render_thread_->sink().GetFirstMessageMatching(
45 AutofillHostMsg_FormsSeen::ID); 44 AutofillHostMsg_FormsSeen::ID);
46 ASSERT_NE(static_cast<IPC::Message*>(NULL), message); 45 ASSERT_NE(static_cast<IPC::Message*>(NULL), message);
47 AutofillHostMsg_FormsSeen::Param params; 46 AutofillHostMsg_FormsSeen::Param params;
48 AutofillHostMsg_FormsSeen::Read(message, &params); 47 AutofillHostMsg_FormsSeen::Read(message, &params);
49 const std::vector<FormData>& forms = params.a; 48 const std::vector<FormData>& forms = params.a;
50 ASSERT_EQ(1UL, forms.size()); 49 ASSERT_EQ(1UL, forms.size());
51 ASSERT_EQ(4UL, forms[0].fields.size()); 50 ASSERT_EQ(4UL, forms[0].fields.size());
52 51
53 FormField expected; 52 FormField expected;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // message so updates will get coalesced, but as soon as we spin the message 130 // message so updates will get coalesced, but as soon as we spin the message
132 // loop, it will generate an update. 131 // loop, it will generate an update.
133 SendContentStateImmediately(); 132 SendContentStateImmediately();
134 133
135 LoadHTML("<form method=\"POST\">" 134 LoadHTML("<form method=\"POST\">"
136 " <input type=\"text\" id=\"firstname\"/>" 135 " <input type=\"text\" id=\"firstname\"/>"
137 " <input type=\"text\" id=\"middlename\"/>" 136 " <input type=\"text\" id=\"middlename\"/>"
138 "</form>"); 137 "</form>");
139 138
140 // Verify that "FormsSeen" isn't sent, as there are too few fields. 139 // Verify that "FormsSeen" isn't sent, as there are too few fields.
141 ProcessPendingMessages();
142 const IPC::Message* message = render_thread_->sink().GetFirstMessageMatching( 140 const IPC::Message* message = render_thread_->sink().GetFirstMessageMatching(
143 AutofillHostMsg_FormsSeen::ID); 141 AutofillHostMsg_FormsSeen::ID);
144 ASSERT_EQ(static_cast<IPC::Message*>(NULL), message); 142 ASSERT_EQ(static_cast<IPC::Message*>(NULL), message);
145 143
146 // Verify that |didAcceptAutofillSuggestion()| sets the value of the expected 144 // Verify that |didAcceptAutofillSuggestion()| sets the value of the expected
147 // field. 145 // field.
148 WebFrame* web_frame = GetMainFrame(); 146 WebFrame* web_frame = GetMainFrame();
149 WebDocument document = web_frame->document(); 147 WebDocument document = web_frame->document();
150 WebInputElement firstname = 148 WebInputElement firstname =
151 document.getElementById("firstname").to<WebInputElement>(); 149 document.getElementById("firstname").to<WebInputElement>();
(...skipping 17 matching lines...) Expand all
169 const IPC::Message* message2 = 167 const IPC::Message* message2 =
170 render_thread_->sink().GetUniqueMessageMatching( 168 render_thread_->sink().GetUniqueMessageMatching(
171 AutofillHostMsg_FillAutofillFormData::ID); 169 AutofillHostMsg_FillAutofillFormData::ID);
172 170
173 // No message should be sent in this case. |firstname| is filled directly. 171 // No message should be sent in this case. |firstname| is filled directly.
174 ASSERT_EQ(static_cast<IPC::Message*>(NULL), message2); 172 ASSERT_EQ(static_cast<IPC::Message*>(NULL), message2);
175 EXPECT_EQ(firstname.value(), WebKit::WebString::fromUTF8("David")); 173 EXPECT_EQ(firstname.value(), WebKit::WebString::fromUTF8("David"));
176 } 174 }
177 175
178 } // namespace autofill 176 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/translate_helper_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698