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

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: 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
« no previous file with comments | « Source/core/dom/DOMImplementation.cpp ('k') | Source/core/inspector/NetworkResourcesData.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/DOMImplementationTest.cpp
diff --git a/Source/core/css/CSSTimingFunctionValue.cpp b/Source/core/dom/DOMImplementationTest.cpp
similarity index 50%
copy from Source/core/css/CSSTimingFunctionValue.cpp
copy to Source/core/dom/DOMImplementationTest.cpp
index 49420cbb26b6b54bb0b0e278abbe146e88b51f0a..df60362e8433174587ce4cbafcfe0bd62dab09c5 100644
--- a/Source/core/css/CSSTimingFunctionValue.cpp
+++ b/Source/core/dom/DOMImplementationTest.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2013 Opera Software ASA. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -21,37 +21,37 @@
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
*/
#include "config.h"
-#include "core/css/CSSTimingFunctionValue.h"
+#include "core/dom/DOMImplementation.h"
#include "wtf/text/WTFString.h"
+#include <gtest/gtest.h>
-namespace WebCore {
-
-String CSSCubicBezierTimingFunctionValue::customCSSText() const
-{
- return "cubic-bezier("
- + String::number(m_x1) + ", "
- + String::number(m_y1) + ", "
- + String::number(m_x2) + ", "
- + String::number(m_y2) + ")";
-}
+using namespace WebCore;
-bool CSSCubicBezierTimingFunctionValue::equals(const CSSCubicBezierTimingFunctionValue& other) const
-{
- return m_x1 == other.m_x1 && m_x2 == other.m_x2 && m_y1 == other.m_y1 && m_y2 == other.m_y2;
-}
+namespace {
-String CSSStepsTimingFunctionValue::customCSSText() const
+TEST(DOMImplementationTest, TextMIMEType)
{
- return "steps(" + String::number(m_steps) + ", " + (m_stepAtStart ? "start" : "end") + ')';
+ 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"));
}
tyoshino (SeeGerritForStatus) 2013/12/02 07:05:13 test getTextDefaultEncodingName?
sof 2013/12/02 07:45:38 Done.
-bool CSSStepsTimingFunctionValue::equals(const CSSStepsTimingFunctionValue& other) const
-{
- return m_steps == other.m_steps && m_stepAtStart == other.m_stepAtStart;
}
-
-} // namespace WebCore
« no previous file with comments | « Source/core/dom/DOMImplementation.cpp ('k') | Source/core/inspector/NetworkResourcesData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698