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

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

Issue 2654933003: platform/testing/{URL|Unit}TestHelpers improvements (Closed)
Patch Set: header changes Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp b/third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp
index 6189e7b0e2709cb0bf79dc3e3437552e45b22b16..a9651d52b3564c2c030593e4205a347317d93823 100644
--- a/third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp
@@ -45,6 +45,7 @@
#include "core/page/Page.h"
#include "platform/geometry/IntSize.h"
#include "platform/testing/URLTestHelpers.h"
+#include "platform/testing/UnitTestHelpers.h"
#include "public/web/WebFrame.h"
#include "public/web/WebSettings.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -54,6 +55,8 @@
namespace blink {
+namespace {
+
KeyboardEvent* createKeyboardEventWithLocation(
KeyboardEvent::KeyLocationCode location) {
KeyboardEventInit keyEventInit;
@@ -69,6 +72,15 @@ int getModifiersForKeyLocationCode(KeyboardEvent::KeyLocationCode location) {
return convertedEvent.modifiers();
}
+void registerMockedURL(const std::string& baseURL,
+ const std::string& fileName) {
+ URLTestHelpers::registerMockedURLLoadFromBase(WebString::fromUTF8(baseURL),
+ testing::webTestDataPath(),
+ WebString::fromUTF8(fileName));
+}
+
+} // namespace
+
TEST(WebInputEventConversionTest, WebKeyboardEventBuilder) {
// Test key location conversion.
int modifiers =
@@ -106,9 +118,7 @@ TEST(WebInputEventConversionTest, InputEventsScaling) {
const std::string baseURL("http://www.test1.com/");
const std::string fileName("fixed_layout.html");
- URLTestHelpers::registerMockedURLFromBaseURL(
- WebString::fromUTF8(baseURL.c_str()),
- WebString::fromUTF8("fixed_layout.html"));
+ registerMockedURL(baseURL, fileName);
FrameTestHelpers::WebViewHelper webViewHelper;
WebViewImpl* webViewImpl =
webViewHelper.initializeAndLoad(baseURL + fileName, true);
@@ -332,9 +342,7 @@ TEST(WebInputEventConversionTest, InputEventsTransform) {
const std::string baseURL("http://www.test2.com/");
const std::string fileName("fixed_layout.html");
- URLTestHelpers::registerMockedURLFromBaseURL(
- WebString::fromUTF8(baseURL.c_str()),
- WebString::fromUTF8("fixed_layout.html"));
+ registerMockedURL(baseURL, fileName);
FrameTestHelpers::WebViewHelper webViewHelper;
WebViewImpl* webViewImpl =
webViewHelper.initializeAndLoad(baseURL + fileName, true);
@@ -614,9 +622,7 @@ TEST(WebInputEventConversionTest, InputEventsConversions) {
const std::string baseURL("http://www.test3.com/");
const std::string fileName("fixed_layout.html");
- URLTestHelpers::registerMockedURLFromBaseURL(
- WebString::fromUTF8(baseURL.c_str()),
- WebString::fromUTF8("fixed_layout.html"));
+ registerMockedURL(baseURL, fileName);
FrameTestHelpers::WebViewHelper webViewHelper;
WebViewImpl* webViewImpl =
webViewHelper.initializeAndLoad(baseURL + fileName, true);
@@ -655,9 +661,7 @@ TEST(WebInputEventConversionTest, VisualViewportOffset) {
const std::string baseURL("http://www.test4.com/");
const std::string fileName("fixed_layout.html");
- URLTestHelpers::registerMockedURLFromBaseURL(
- WebString::fromUTF8(baseURL.c_str()),
- WebString::fromUTF8("fixed_layout.html"));
+ registerMockedURL(baseURL, fileName);
FrameTestHelpers::WebViewHelper webViewHelper;
WebViewImpl* webViewImpl =
webViewHelper.initializeAndLoad(baseURL + fileName, true);
@@ -766,9 +770,7 @@ TEST(WebInputEventConversionTest, ElasticOverscroll) {
const std::string baseURL("http://www.test5.com/");
const std::string fileName("fixed_layout.html");
- URLTestHelpers::registerMockedURLFromBaseURL(
- WebString::fromUTF8(baseURL.c_str()),
- WebString::fromUTF8("fixed_layout.html"));
+ registerMockedURL(baseURL, fileName);
FrameTestHelpers::WebViewHelper webViewHelper;
WebViewImpl* webViewImpl =
webViewHelper.initializeAndLoad(baseURL + fileName, true);
@@ -845,9 +847,7 @@ TEST(WebInputEventConversionTest, ElasticOverscrollWithPageReload) {
const std::string baseURL("http://www.test6.com/");
const std::string fileName("fixed_layout.html");
- URLTestHelpers::registerMockedURLFromBaseURL(
- WebString::fromUTF8(baseURL.c_str()),
- WebString::fromUTF8("fixed_layout.html"));
+ registerMockedURL(baseURL, fileName);
FrameTestHelpers::WebViewHelper webViewHelper;
WebViewImpl* webViewImpl =
webViewHelper.initializeAndLoad(baseURL + fileName, true);
« no previous file with comments | « third_party/WebKit/Source/web/tests/WebImageTest.cpp ('k') | third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698