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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebSearchableFormDataTest.cpp

Issue 1845323002: Remove WebUnitTestSupport (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "public/web/WebSearchableFormData.h" 31 #include "public/web/WebSearchableFormData.h"
32 32
33 #include "platform/testing/URLTestHelpers.h" 33 #include "platform/testing/URLTestHelpers.h"
34 #include "public/platform/Platform.h" 34 #include "public/platform/Platform.h"
35 #include "public/platform/WebUnitTestSupport.h" 35 #include "public/platform/WebURLLoaderMockFactory.h"
36 #include "public/web/WebCache.h"
36 #include "public/web/WebDocument.h" 37 #include "public/web/WebDocument.h"
37 #include "public/web/WebFrame.h" 38 #include "public/web/WebFrame.h"
38 #include "testing/gmock/include/gmock/gmock.h" 39 #include "testing/gmock/include/gmock/gmock.h"
39 #include "testing/gtest/include/gtest/gtest.h" 40 #include "testing/gtest/include/gtest/gtest.h"
40 #include "web/tests/FrameTestHelpers.h" 41 #include "web/tests/FrameTestHelpers.h"
41 42
42 namespace blink { 43 namespace blink {
43 44
44 class WebSearchableFormDataTest : public testing::Test { 45 class WebSearchableFormDataTest : public testing::Test {
45 protected: 46 protected:
46 WebSearchableFormDataTest() 47 WebSearchableFormDataTest()
47 : m_baseURL("http://www.test.com/") 48 : m_baseURL("http://www.test.com/")
48 { 49 {
49 } 50 }
50 51
51 ~WebSearchableFormDataTest() override 52 ~WebSearchableFormDataTest() override
52 { 53 {
53 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); 54 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs();
55 WebCache::clear();
54 } 56 }
55 57
56 FrameTestHelpers::WebViewHelper m_webViewHelper; 58 FrameTestHelpers::WebViewHelper m_webViewHelper;
57 std::string m_baseURL; 59 std::string m_baseURL;
58 }; 60 };
59 61
60 62
61 TEST_F(WebSearchableFormDataTest, SearchString) 63 TEST_F(WebSearchableFormDataTest, SearchString)
62 { 64 {
63 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), "search_form.html"); 65 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), "search_form.html");
64 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "search_for m.html"); 66 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "search_for m.html");
65 67
66 WebVector<WebFormElement> forms; 68 WebVector<WebFormElement> forms;
67 webView->mainFrame()->document().forms(forms); 69 webView->mainFrame()->document().forms(forms);
68 70
69 EXPECT_EQ(forms.size(), 1U); 71 EXPECT_EQ(forms.size(), 1U);
70 72
71 WebSearchableFormData searchableFormData(forms[0]); 73 WebSearchableFormData searchableFormData(forms[0]);
72 EXPECT_EQ("http://www.mock.url/search?hl=en&q={searchTerms}&btnM=Mock+Search ", searchableFormData.url().string()); 74 EXPECT_EQ("http://www.mock.url/search?hl=en&q={searchTerms}&btnM=Mock+Search ", searchableFormData.url().string());
73 } 75 }
74 76
75 } // namespace blink 77 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698