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

Unified Diff: third_party/WebKit/Source/core/html/HTMLAnchorElementTest.cpp

Issue 1668553003: Fix server-side image map click location with "Open link in new tab" Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add Test for HTMLAnchorElement Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLAnchorElementTest.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLAnchorElementTest.cpp b/third_party/WebKit/Source/core/html/HTMLAnchorElementTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..84f19705ad4ac7f9be91b8e2dc22af2d3e621a96
--- /dev/null
+++ b/third_party/WebKit/Source/core/html/HTMLAnchorElementTest.cpp
@@ -0,0 +1,38 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
tkent 2016/03/14 00:06:33 2014 -> 2016
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/html/HTMLAnchorElement.h"
+
+#include "core/dom/Document.h"
+#include "core/events/Event.h"
+#include "core/events/MouseEvent.h"
+#include "core/testing/DummyPageHolder.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace blink {
+
+TEST(HTMLAnchorElementTest, getClampedPointFromEventWithNull)
+{
+ IntPoint clampedPoint;
+ bool success = HTMLAnchorElement::getClampedPointFromEvent(clampedPoint, nullptr);
+ EXPECT_EQ(success, false);
+}
+
+TEST(HTMLAnchorElementTest, getClampedPointFromEventWithEmptyMouseEvent)
+{
+ IntPoint clampedPoint;
+ RefPtrWillBeRawPtr<MouseEvent> event = MouseEvent::create();
+ bool success = HTMLAnchorElement::getClampedPointFromEvent(clampedPoint, event);
+ EXPECT_EQ(success, false);
+}
+
+TEST(HTMLAnchorElementTest, appendServerMapMousePosition)
+{
+ StringBuilder url;
+ IntPoint clampedPoint(20, 20);
+ HTMLAnchorElement::appendServerMapMousePosition(url, clampedPoint);
+ EXPECT_EQ(url.toString(), "?20,20");
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698