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

Side by Side Diff: Source/web/tests/WebViewTest.cpp

Issue 995363002: Implement autocapitalize in Blink to be used by the embedder. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: update webexposed tests Created 5 years, 9 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
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/data/text_input_flags.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after
2087 NonUserInputTextUpdateWebViewClient client; 2087 NonUserInputTextUpdateWebViewClient client;
2088 std::string url = m_baseURL + "text_input_flags.html"; 2088 std::string url = m_baseURL + "text_input_flags.html";
2089 URLTestHelpers::registerMockedURLLoad(toKURL(url), "text_input_flags.html"); 2089 URLTestHelpers::registerMockedURLLoad(toKURL(url), "text_input_flags.html");
2090 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(url, true, 0, & client); 2090 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(url, true, 0, & client);
2091 webViewImpl->setInitialFocus(false); 2091 webViewImpl->setInitialFocus(false);
2092 2092
2093 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewImpl->mainFrame()); 2093 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewImpl->mainFrame());
2094 HTMLDocument* document = toHTMLDocument(frame->frame()->document()); 2094 HTMLDocument* document = toHTMLDocument(frame->frame()->document());
2095 2095
2096 // (A) <input> 2096 // (A) <input>
2097 // (A.1) Verifies autocorrect/autocomplete/spellcheck flags are Off. 2097 // (A.1) Verifies autocorrect/autocomplete/spellcheck flags are Off and
2098 // autocapitalize is set to none.
2098 HTMLInputElement* inputElement = toHTMLInputElement(document->getElementById ("input")); 2099 HTMLInputElement* inputElement = toHTMLInputElement(document->getElementById ("input"));
2099 document->setFocusedElement(inputElement); 2100 document->setFocusedElement(inputElement);
2100 webViewImpl->setFocus(true); 2101 webViewImpl->setFocus(true);
2101 WebTextInputInfo info = webViewImpl->textInputInfo(); 2102 WebTextInputInfo info = webViewImpl->textInputInfo();
2102 EXPECT_EQ( 2103 EXPECT_EQ(
2103 WebTextInputFlagAutocompleteOff | WebTextInputFlagAutocorrectOff | WebTe xtInputFlagSpellcheckOff, 2104 WebTextInputFlagAutocompleteOff | WebTextInputFlagAutocorrectOff | WebTe xtInputFlagSpellcheckOff | WebTextInputFlagAutocapitalizeNone,
2104 info.flags); 2105 info.flags);
2105 2106
2106 // (A.2) Verifies autocorrect/autocomplete/spellcheck flags are On. 2107 // (A.2) Verifies autocorrect/autocomplete/spellcheck flags are On and
2108 // autocapitalize is set to sentences.
2107 inputElement = toHTMLInputElement(document->getElementById("input2")); 2109 inputElement = toHTMLInputElement(document->getElementById("input2"));
2108 document->setFocusedElement(inputElement); 2110 document->setFocusedElement(inputElement);
2109 webViewImpl->setFocus(true); 2111 webViewImpl->setFocus(true);
2110 info = webViewImpl->textInputInfo(); 2112 info = webViewImpl->textInputInfo();
2111 EXPECT_EQ( 2113 EXPECT_EQ(
2112 WebTextInputFlagAutocompleteOn | WebTextInputFlagAutocorrectOn | WebText InputFlagSpellcheckOn, 2114 WebTextInputFlagAutocompleteOn | WebTextInputFlagAutocorrectOn | WebText InputFlagSpellcheckOn | WebTextInputFlagAutocapitalizeSentences,
2113 info.flags); 2115 info.flags);
2114 2116
2115 // (B) <textarea> Verifies the default text input flags are 2117 // (B) <textarea> Verifies the default text input flags are
2116 // WebTextInputFlagNone. 2118 // WebTextInputFlagAutocapitalizeSentences.
2117 HTMLTextAreaElement* textAreaElement = toHTMLTextAreaElement(document->getEl ementById("textarea")); 2119 HTMLTextAreaElement* textAreaElement = toHTMLTextAreaElement(document->getEl ementById("textarea"));
2118 document->setFocusedElement(textAreaElement); 2120 document->setFocusedElement(textAreaElement);
2119 webViewImpl->setFocus(true); 2121 webViewImpl->setFocus(true);
2120 info = webViewImpl->textInputInfo(); 2122 info = webViewImpl->textInputInfo();
2121 EXPECT_EQ(WebTextInputFlagNone, info.flags); 2123 EXPECT_EQ(WebTextInputFlagAutocapitalizeSentences, info.flags);
2122 2124
2123 // Free the webView before freeing the NonUserInputTextUpdateWebViewClient. 2125 // Free the webView before freeing the NonUserInputTextUpdateWebViewClient.
2124 m_webViewHelper.reset(); 2126 m_webViewHelper.reset();
2125 } 2127 }
2126 2128
2127 // This test verifies that WebWidgetClient::didUpdateTextOfFocusedElementByNonUs erInput is 2129 // This test verifies that WebWidgetClient::didUpdateTextOfFocusedElementByNonUs erInput is
2128 // called iff value of a focused element is modified via script. 2130 // called iff value of a focused element is modified via script.
2129 TEST_F(WebViewTest, NonUserInputTextUpdate) 2131 TEST_F(WebViewTest, NonUserInputTextUpdate)
2130 { 2132 {
2131 NonUserInputTextUpdateWebViewClient client; 2133 NonUserInputTextUpdateWebViewClient client;
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
2473 // Test without any preventDefault. 2475 // Test without any preventDefault.
2474 client.reset(); 2476 client.reset();
2475 frame->executeScript(WebScriptSource("setTest('none');")); 2477 frame->executeScript(WebScriptSource("setTest('none');"));
2476 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr omUTF8("target"))); 2478 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr omUTF8("target")));
2477 EXPECT_TRUE(client.getWasCalled()); 2479 EXPECT_TRUE(client.getWasCalled());
2478 2480
2479 m_webViewHelper.reset(); // Remove dependency on locally scoped client. 2481 m_webViewHelper.reset(); // Remove dependency on locally scoped client.
2480 } 2482 }
2481 2483
2482 } // namespace 2484 } // namespace
OLDNEW
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/data/text_input_flags.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698