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

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: 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
Index: Source/wtf/text/AtomicStringTest.cpp
diff --git a/Source/modules/speech/testing/InternalsSpeechSynthesis.cpp b/Source/wtf/text/AtomicStringTest.cpp
similarity index 55%
copy from Source/modules/speech/testing/InternalsSpeechSynthesis.cpp
copy to Source/wtf/text/AtomicStringTest.cpp
index d1e62296a3597b7bb336d1c6328aaab89c9fdb16..67b43ed323a8c95fa0e0522cd1f8baa514a919e0 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(WTF, AtomicStringCreationFromNumber)
tkent 2013/11/24 21:20:04 We usually specify <test target name> + "Test" for
Inactive 2013/11/24 21:48:13 I see, I used WTFStringTest.cpp as reference but I
Inactive 2013/11/24 23:19:17 Done.
{
- 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

Powered by Google App Engine
This is Rietveld 408576698