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

Unified Diff: Source/core/dom/DOMImplementationTest.cpp

Issue 94893003: Support for json media types as (non-image) mime types. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added DOMImplementation::isJSONMIMEType() and use it to resolve default encodings Created 7 years 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: Source/core/dom/DOMImplementationTest.cpp
diff --git a/Source/platform/LengthPoint.h b/Source/core/dom/DOMImplementationTest.cpp
similarity index 54%
copy from Source/platform/LengthPoint.h
copy to Source/core/dom/DOMImplementationTest.cpp
index 75497a1dcc3447a9f6d0598f6e67c4ef7eb9cc6d..8570ac553aef6dcf0c5207244f8e0774aea5fd34 100644
--- a/Source/platform/LengthPoint.h
+++ b/Source/core/dom/DOMImplementationTest.cpp
@@ -27,39 +27,34 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef LengthPoint_h
-#define LengthPoint_h
-
-#include "platform/Length.h"
-
-namespace WebCore {
-
-struct LengthPoint {
-public:
- LengthPoint()
- {
- }
-
- LengthPoint(Length x, Length y)
- : m_x(x)
- , m_y(y)
- {
- }
-
- bool operator==(const LengthPoint& o) const { return m_x == o.m_x && m_y == o.m_y; }
- bool operator!=(const LengthPoint& o) const { return m_x != o.m_x || m_y != o.m_y; }
-
- void setX(Length x) { m_x = x; }
- Length x() const { return m_x; }
-
- void setY(Length y) { m_y = y; }
- Length y() const { return m_y; }
-
-private:
- Length m_x;
- Length m_y;
-};
-
-} // namespace WebCore
-
-#endif // LengthPoint_h
+#include "config.h"
+#include "core/dom/DOMImplementation.h"
+
+#include "wtf/text/WTFString.h"
+#include <gtest/gtest.h>
+
+using namespace WebCore;
+
+namespace {
+
+TEST(DOMImplementationTest, TextMIMEType)
+{
+ EXPECT_TRUE(DOMImplementation::isTextMIMEType("text/plain"));
+ EXPECT_TRUE(DOMImplementation::isTextMIMEType("text/javascript"));
+ EXPECT_TRUE(DOMImplementation::isTextMIMEType("application/json"));
+ EXPECT_TRUE(DOMImplementation::isTextMIMEType("application/+json"));
+ EXPECT_TRUE(DOMImplementation::isTextMIMEType("application/x-javascript-like+json;a=2;c=4"));
+ EXPECT_TRUE(DOMImplementation::isTextMIMEType("application/javascript"));
+ EXPECT_TRUE(DOMImplementation::isTextMIMEType("application/x-custom+json;b=3"));
+ EXPECT_TRUE(DOMImplementation::isTextMIMEType("application/x-custom+json"));
+ // Outside of RFC-2045 grammar, but robustly accept/allow.
+ EXPECT_TRUE(DOMImplementation::isTextMIMEType("application/x-what+json;"));
+ EXPECT_TRUE(DOMImplementation::isTextMIMEType("application/json;"));
+
+ EXPECT_FALSE(DOMImplementation::isTextMIMEType("application/x-custom;a=a+json"));
+ EXPECT_FALSE(DOMImplementation::isTextMIMEType("text/html"));
+ EXPECT_FALSE(DOMImplementation::isTextMIMEType("text/xml"));
+ EXPECT_FALSE(DOMImplementation::isTextMIMEType("text/xsl"));
+}
+
+}

Powered by Google App Engine
This is Rietveld 408576698