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

Unified Diff: Source/wtf/text/AtomicStringTest.cpp

Issue 84713002: Add number() static methods to AtomicString class (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Pass NaN as default argument Created 7 years, 1 month 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/wtf/text/AtomicString.cpp ('k') | Source/wtf/text/IntegerToStringConversion.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/text/AtomicStringTest.cpp
diff --git a/Source/modules/speech/testing/InternalsSpeechSynthesis.cpp b/Source/wtf/text/AtomicStringTest.cpp
similarity index 56%
copy from Source/modules/speech/testing/InternalsSpeechSynthesis.cpp
copy to Source/wtf/text/AtomicStringTest.cpp
index d1e62296a3597b7bb336d1c6328aaab89c9fdb16..263fdc311711842d906ee153cda3e8d01c45748e 100644
--- a/Source/modules/speech/testing/InternalsSpeechSynthesis.cpp
+++ b/Source/wtf/text/AtomicStringTest.cpp
@@ -29,25 +29,36 @@
*/
#include "config.h"
-#include "InternalsSpeechSynthesis.h"
+#include "AtomicString.h"
-#include "core/dom/Document.h"
-#include "core/platform/mock/PlatformSpeechSynthesizerMock.h"
-#include "core/testing/Internals.h"
-#include "modules/speech/DOMWindowSpeechSynthesis.h"
-#include "modules/speech/SpeechSynthesis.h"
+#include <gtest/gtest.h>
-namespace WebCore {
+namespace {
-void InternalsSpeechSynthesis::enableMockSpeechSynthesizer(Internals* internals, Document* document)
+TEST(AtomicStringTest, Number)
{
- ASSERT(internals && document && document->domWindow());
-
- SpeechSynthesis* synthesis = DOMWindowSpeechSynthesis::speechSynthesis(document->domWindow());
- if (!synthesis)
- return;
-
- synthesis->setPlatformSynthesizer(PlatformSpeechSynthesizerMock::create(synthesis));
+ int intValue = 1234;
+ ASSERT_EQ(AtomicString::number(intValue), "1234");
+ intValue = -1234;
+ ASSERT_EQ(AtomicString::number(intValue), "-1234");
+ unsigned unsignedValue = 1234u;
+ ASSERT_EQ(AtomicString::number(unsignedValue), "1234");
+ long longValue = 6553500;
+ ASSERT_EQ(AtomicString::number(longValue), "6553500");
+ longValue = -6553500;
+ ASSERT_EQ(AtomicString::number(longValue), "-6553500");
+ unsigned long unsignedLongValue = 4294967295u;
+ ASSERT_EQ(AtomicString::number(unsignedLongValue), "4294967295");
+ long long longlongValue = 9223372036854775807;
+ ASSERT_EQ(AtomicString::number(longlongValue), "9223372036854775807");
+ longlongValue = -9223372036854775807;
+ ASSERT_EQ(AtomicString::number(longlongValue), "-9223372036854775807");
+ unsigned long long unsignedLongLongValue = 18446744073709551615u;
+ ASSERT_EQ(AtomicString::number(unsignedLongLongValue), "18446744073709551615");
+ double doubleValue = 1234.56;
+ ASSERT_EQ(AtomicString::number(doubleValue), "1234.56");
+ doubleValue = 1234.56789;
+ ASSERT_EQ(AtomicString::number(doubleValue, 9), "1234.56789");
}
-} // namespace WebCore
+} // namespace
« no previous file with comments | « Source/wtf/text/AtomicString.cpp ('k') | Source/wtf/text/IntegerToStringConversion.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698