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

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

Issue 1174283002: Fix unit test style in Source/web/. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove static Created 5 years, 6 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 /* 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 11 matching lines...) Expand all
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
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 "config.h" 31 #include "config.h"
32
33 #include "public/web/WebSearchableFormData.h" 32 #include "public/web/WebSearchableFormData.h"
34 33
35 #include "platform/testing/URLTestHelpers.h" 34 #include "platform/testing/URLTestHelpers.h"
36 #include "public/platform/Platform.h" 35 #include "public/platform/Platform.h"
37 #include "public/platform/WebUnitTestSupport.h" 36 #include "public/platform/WebUnitTestSupport.h"
38 #include "public/web/WebDocument.h" 37 #include "public/web/WebDocument.h"
39 #include "public/web/WebFrame.h" 38 #include "public/web/WebFrame.h"
40 #include "web/tests/FrameTestHelpers.h" 39 #include "web/tests/FrameTestHelpers.h"
41
42 #include <gmock/gmock.h> 40 #include <gmock/gmock.h>
43 #include <gtest/gtest.h> 41 #include <gtest/gtest.h>
44 42
45 using namespace blink; 43 namespace blink {
46 44
47 class WebSearchableFormDataTest : public testing::Test { 45 class WebSearchableFormDataTest : public testing::Test {
48 protected: 46 protected:
49 WebSearchableFormDataTest() 47 WebSearchableFormDataTest()
50 : m_baseURL("http://www.test.com/") 48 : m_baseURL("http://www.test.com/")
51 { 49 {
52 } 50 }
53 51
54 virtual ~WebSearchableFormDataTest() 52 ~WebSearchableFormDataTest() override
55 { 53 {
56 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); 54 Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
57 } 55 }
58 56
59
60 FrameTestHelpers::WebViewHelper m_webViewHelper; 57 FrameTestHelpers::WebViewHelper m_webViewHelper;
61 std::string m_baseURL; 58 std::string m_baseURL;
62 }; 59 };
63 60
64 61
65 TEST_F(WebSearchableFormDataTest, SearchString) 62 TEST_F(WebSearchableFormDataTest, SearchString)
66 { 63 {
67 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), "search_form.html"); 64 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), "search_form.html");
68 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "search_for m.html"); 65 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "search_for m.html");
69 66
70 WebVector<WebFormElement> forms; 67 WebVector<WebFormElement> forms;
71 webView->mainFrame()->document().forms(forms); 68 webView->mainFrame()->document().forms(forms);
72 69
73 EXPECT_EQ(forms.size(), 1U); 70 EXPECT_EQ(forms.size(), 1U);
74 71
75 WebSearchableFormData searchableFormData(forms[0]); 72 WebSearchableFormData searchableFormData(forms[0]);
76 EXPECT_EQ("http://www.mock.url/search?hl=en&q={searchTerms}&btnM=Mock+Search ", searchableFormData.url().string()); 73 EXPECT_EQ("http://www.mock.url/search?hl=en&q={searchTerms}&btnM=Mock+Search ", searchableFormData.url().string());
77 } 74 }
75
76 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/tests/WebScopedWindowFocusAllowedIndicatorTest.cpp ('k') | Source/web/tests/WebSelectorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698