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

Side by Side Diff: chrome/renderer/render_view_browsertest.cc

Issue 6437001: Pull in a named constant from WebKit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Namespace. Created 9 years, 10 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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/basictypes.h" 5 #include "base/basictypes.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/shared_memory.h" 8 #include "base/shared_memory.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 22 matching lines...) Expand all
33 33
34 using WebKit::WebDocument; 34 using WebKit::WebDocument;
35 using WebKit::WebFrame; 35 using WebKit::WebFrame;
36 using WebKit::WebInputElement; 36 using WebKit::WebInputElement;
37 using WebKit::WebString; 37 using WebKit::WebString;
38 using WebKit::WebTextDirection; 38 using WebKit::WebTextDirection;
39 using WebKit::WebURLError; 39 using WebKit::WebURLError;
40 using webkit_glue::FormData; 40 using webkit_glue::FormData;
41 using webkit_glue::FormField; 41 using webkit_glue::FormField;
42 42
43 namespace {
44
45 // TODO(isherman): Pull this as a named constant from WebKit
46 const int kDefaultMaxLength = 0x80000;
47
48 } // namespace
49
50 // Test that we get form state change notifications when input fields change. 43 // Test that we get form state change notifications when input fields change.
51 TEST_F(RenderViewTest, OnNavStateChanged) { 44 TEST_F(RenderViewTest, OnNavStateChanged) {
52 // Don't want any delay for form state sync changes. This will still post a 45 // Don't want any delay for form state sync changes. This will still post a
53 // message so updates will get coalesced, but as soon as we spin the message 46 // message so updates will get coalesced, but as soon as we spin the message
54 // loop, it will generate an update. 47 // loop, it will generate an update.
55 view_->set_send_content_state_immediately(true); 48 view_->set_send_content_state_immediately(true);
56 49
57 LoadHTML("<input type=\"text\" id=\"elt_text\"></input>"); 50 LoadHTML("<input type=\"text\" id=\"elt_text\"></input>");
58 51
59 // We should NOT have gotten a form state change notification yet. 52 // We should NOT have gotten a form state change notification yet.
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 AutoFillHostMsg_FormsSeen::Param params; 1031 AutoFillHostMsg_FormsSeen::Param params;
1039 AutoFillHostMsg_FormsSeen::Read(message, &params); 1032 AutoFillHostMsg_FormsSeen::Read(message, &params);
1040 const std::vector<FormData>& forms = params.a; 1033 const std::vector<FormData>& forms = params.a;
1041 ASSERT_EQ(1UL, forms.size()); 1034 ASSERT_EQ(1UL, forms.size());
1042 ASSERT_EQ(3UL, forms[0].fields.size()); 1035 ASSERT_EQ(3UL, forms[0].fields.size());
1043 EXPECT_TRUE(forms[0].fields[0].StrictlyEqualsHack( 1036 EXPECT_TRUE(forms[0].fields[0].StrictlyEqualsHack(
1044 FormField(string16(), 1037 FormField(string16(),
1045 ASCIIToUTF16("firstname"), 1038 ASCIIToUTF16("firstname"),
1046 string16(), 1039 string16(),
1047 ASCIIToUTF16("text"), 1040 ASCIIToUTF16("text"),
1048 kDefaultMaxLength, 1041 WebInputElement::defaultMaxLength(),
1049 false))) << forms[0].fields[0]; 1042 false))) << forms[0].fields[0];
1050 EXPECT_TRUE(forms[0].fields[1].StrictlyEqualsHack( 1043 EXPECT_TRUE(forms[0].fields[1].StrictlyEqualsHack(
1051 FormField(string16(), 1044 FormField(string16(),
1052 ASCIIToUTF16("middlename"), 1045 ASCIIToUTF16("middlename"),
1053 string16(), 1046 string16(),
1054 ASCIIToUTF16("text"), 1047 ASCIIToUTF16("text"),
1055 kDefaultMaxLength, 1048 WebInputElement::defaultMaxLength(),
1056 false))) << forms[0].fields[1]; 1049 false))) << forms[0].fields[1];
1057 EXPECT_TRUE(forms[0].fields[2].StrictlyEqualsHack( 1050 EXPECT_TRUE(forms[0].fields[2].StrictlyEqualsHack(
1058 FormField(string16(), 1051 FormField(string16(),
1059 ASCIIToUTF16("state"), 1052 ASCIIToUTF16("state"),
1060 ASCIIToUTF16("?"), 1053 ASCIIToUTF16("?"),
1061 ASCIIToUTF16("select-one"), 1054 ASCIIToUTF16("select-one"),
1062 0, 1055 0,
1063 false))) << forms[0].fields[2]; 1056 false))) << forms[0].fields[2];
1064 1057
1065 // Verify that |didAcceptAutoFillSuggestion()| sends the expected number of 1058 // Verify that |didAcceptAutoFillSuggestion()| sends the expected number of
(...skipping 19 matching lines...) Expand all
1085 ASSERT_NE(static_cast<IPC::Message*>(NULL), message2); 1078 ASSERT_NE(static_cast<IPC::Message*>(NULL), message2);
1086 AutoFillHostMsg_FillAutoFillFormData::Param params2; 1079 AutoFillHostMsg_FillAutoFillFormData::Param params2;
1087 AutoFillHostMsg_FillAutoFillFormData::Read(message2, &params2); 1080 AutoFillHostMsg_FillAutoFillFormData::Read(message2, &params2);
1088 const FormData& form2 = params2.b; 1081 const FormData& form2 = params2.b;
1089 ASSERT_EQ(3UL, form2.fields.size()); 1082 ASSERT_EQ(3UL, form2.fields.size());
1090 EXPECT_TRUE(form2.fields[0].StrictlyEqualsHack( 1083 EXPECT_TRUE(form2.fields[0].StrictlyEqualsHack(
1091 FormField(string16(), 1084 FormField(string16(),
1092 ASCIIToUTF16("firstname"), 1085 ASCIIToUTF16("firstname"),
1093 string16(), 1086 string16(),
1094 ASCIIToUTF16("text"), 1087 ASCIIToUTF16("text"),
1095 kDefaultMaxLength, 1088 WebInputElement::defaultMaxLength(),
1096 false))) << form2.fields[0]; 1089 false))) << form2.fields[0];
1097 EXPECT_TRUE(form2.fields[1].StrictlyEqualsHack( 1090 EXPECT_TRUE(form2.fields[1].StrictlyEqualsHack(
1098 FormField(string16(), 1091 FormField(string16(),
1099 ASCIIToUTF16("middlename"), 1092 ASCIIToUTF16("middlename"),
1100 string16(), 1093 string16(),
1101 ASCIIToUTF16("text"), 1094 ASCIIToUTF16("text"),
1102 kDefaultMaxLength, 1095 WebInputElement::defaultMaxLength(),
1103 false))) << form2.fields[1]; 1096 false))) << form2.fields[1];
1104 EXPECT_TRUE(form2.fields[2].StrictlyEqualsHack( 1097 EXPECT_TRUE(form2.fields[2].StrictlyEqualsHack(
1105 FormField(string16(), 1098 FormField(string16(),
1106 ASCIIToUTF16("state"), 1099 ASCIIToUTF16("state"),
1107 ASCIIToUTF16("?"), 1100 ASCIIToUTF16("?"),
1108 ASCIIToUTF16("select-one"), 1101 ASCIIToUTF16("select-one"),
1109 0, 1102 0,
1110 false))) << form2.fields[2]; 1103 false))) << form2.fields[2];
1111 } 1104 }
1112 1105
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 LoadHTML("<html><head><meta http-equiv=\"content-language\" " 1208 LoadHTML("<html><head><meta http-equiv=\"content-language\" "
1216 "content=\" fr , es,en \">" 1209 "content=\" fr , es,en \">"
1217 "</head><body>A random page with random content.</body></html>"); 1210 "</head><body>A random page with random content.</body></html>");
1218 ProcessPendingMessages(); 1211 ProcessPendingMessages();
1219 message = render_thread_.sink().GetUniqueMessageMatching( 1212 message = render_thread_.sink().GetUniqueMessageMatching(
1220 ViewHostMsg_PageContents::ID); 1213 ViewHostMsg_PageContents::ID);
1221 ASSERT_NE(static_cast<IPC::Message*>(NULL), message); 1214 ASSERT_NE(static_cast<IPC::Message*>(NULL), message);
1222 ViewHostMsg_PageContents::Read(message, &params); 1215 ViewHostMsg_PageContents::Read(message, &params);
1223 EXPECT_EQ("fr", params.d); 1216 EXPECT_EQ("fr", params.d);
1224 } 1217 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698