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

Unified Diff: third_party/WebKit/Source/web/tests/WebSearchableFormDataTest.cpp

Issue 2505933005: Auto-Generating Search Engines - Remove HTTP Restriction (Closed)
Patch Set: added test Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/web/tests/WebSearchableFormDataTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebSearchableFormDataTest.cpp b/third_party/WebKit/Source/web/tests/WebSearchableFormDataTest.cpp
index 7967a811f704aaa04cd54961884c96ad86522320..0fb06453946827901ad974b77fdc9079277e6cfa 100644
--- a/third_party/WebKit/Source/web/tests/WebSearchableFormDataTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebSearchableFormDataTest.cpp
@@ -44,7 +44,7 @@ namespace blink {
class WebSearchableFormDataTest : public testing::Test {
protected:
- WebSearchableFormDataTest() : m_baseURL("http://www.test.com/") {}
+ WebSearchableFormDataTest() {}
~WebSearchableFormDataTest() override {
Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs();
@@ -52,14 +52,14 @@ class WebSearchableFormDataTest : public testing::Test {
}
FrameTestHelpers::WebViewHelper m_webViewHelper;
- std::string m_baseURL;
};
-TEST_F(WebSearchableFormDataTest, SearchString) {
+TEST_F(WebSearchableFormDataTest, HttpSearchString) {
+ std::string baseURL("http://www.test.com/");
URLTestHelpers::registerMockedURLFromBaseURL(
- WebString::fromUTF8(m_baseURL.c_str()), "search_form.html");
+ WebString::fromUTF8(baseURL.c_str()), "search_form_http.html");
WebView* webView =
- m_webViewHelper.initializeAndLoad(m_baseURL + "search_form.html");
+ m_webViewHelper.initializeAndLoad(baseURL + "search_form_http.html");
WebVector<WebFormElement> forms;
webView->mainFrame()->document().forms(forms);
@@ -71,4 +71,22 @@ TEST_F(WebSearchableFormDataTest, SearchString) {
searchableFormData.url().string());
}
+TEST_F(WebSearchableFormDataTest, HttpsSearchString) {
+ std::string baseURL("https://www.test.com/");
+ URLTestHelpers::registerMockedURLFromBaseURL(
+ WebString::fromUTF8(baseURL.c_str()), "search_form_https.html");
+ WebView* webView =
+ m_webViewHelper.initializeAndLoad(baseURL + "search_form_https.html");
+
+ WebVector<WebFormElement> forms;
+ webView->mainFrame()->document().forms(forms);
+
+ EXPECT_EQ(forms.size(), 1U);
+
+ WebSearchableFormData searchableFormData(forms[0]);
+ EXPECT_EQ(
+ "https://www.mock.url/search?hl=en&q={searchTerms}&btnM=Mock+Search",
+ searchableFormData.url().string());
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/web/WebSearchableFormData.cpp ('k') | third_party/WebKit/Source/web/tests/data/search_form.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698