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

Side by Side Diff: third_party/WebKit/Source/wtf/text/WTFStringTest.cpp

Issue 2655853003: Replace StringImpl::empty{16Bit}() with a static member (Closed)
Patch Set: annotate race Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/wtf/text/WTFString.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 string8.ensure16Bit(); 438 string8.ensure16Bit();
439 EXPECT_FALSE(string8.is8Bit()); 439 EXPECT_FALSE(string8.is8Bit());
440 EXPECT_EQ("8bit", string8); 440 EXPECT_EQ("8bit", string8);
441 441
442 String string16(reinterpret_cast<const UChar*>(u"16bit")); 442 String string16(reinterpret_cast<const UChar*>(u"16bit"));
443 EXPECT_FALSE(string16.is8Bit()); 443 EXPECT_FALSE(string16.is8Bit());
444 string16.ensure16Bit(); 444 string16.ensure16Bit();
445 EXPECT_FALSE(string16.is8Bit()); 445 EXPECT_FALSE(string16.is8Bit());
446 EXPECT_EQ("16bit", string16); 446 EXPECT_EQ("16bit", string16);
447 447
448 String empty8(StringImpl::empty()); 448 String empty8(StringImpl::empty);
449 EXPECT_TRUE(empty8.is8Bit()); 449 EXPECT_TRUE(empty8.is8Bit());
450 empty8.ensure16Bit(); 450 empty8.ensure16Bit();
451 EXPECT_FALSE(empty8.is8Bit()); 451 EXPECT_FALSE(empty8.is8Bit());
452 EXPECT_TRUE(empty8.isEmpty()); 452 EXPECT_TRUE(empty8.isEmpty());
453 EXPECT_FALSE(empty8.isNull()); 453 EXPECT_FALSE(empty8.isNull());
454 454
455 String empty16(StringImpl::empty16Bit()); 455 String empty16(StringImpl::empty16Bit);
456 EXPECT_FALSE(empty16.is8Bit()); 456 EXPECT_FALSE(empty16.is8Bit());
457 empty16.ensure16Bit(); 457 empty16.ensure16Bit();
458 EXPECT_FALSE(empty16.is8Bit()); 458 EXPECT_FALSE(empty16.is8Bit());
459 EXPECT_TRUE(empty16.isEmpty()); 459 EXPECT_TRUE(empty16.isEmpty());
460 EXPECT_FALSE(empty16.isNull()); 460 EXPECT_FALSE(empty16.isNull());
461 461
462 String nullString; 462 String nullString;
463 nullString.ensure16Bit(); 463 nullString.ensure16Bit();
464 EXPECT_TRUE(nullString.isNull()); 464 EXPECT_TRUE(nullString.isNull());
465 } 465 }
(...skipping 27 matching lines...) Expand all
493 EXPECT_EQ(CString("<null>"), toCStringThroughPrinter(String())); 493 EXPECT_EQ(CString("<null>"), toCStringThroughPrinter(String()));
494 494
495 static const UChar unicodeSample[] = {0x30C6, 0x30B9, 495 static const UChar unicodeSample[] = {0x30C6, 0x30B9,
496 0x30C8}; // "Test" in Japanese. 496 0x30C8}; // "Test" in Japanese.
497 EXPECT_EQ(CString("\"\\u30C6\\u30B9\\u30C8\""), 497 EXPECT_EQ(CString("\"\\u30C6\\u30B9\\u30C8\""),
498 toCStringThroughPrinter( 498 toCStringThroughPrinter(
499 String(unicodeSample, WTF_ARRAY_LENGTH(unicodeSample)))); 499 String(unicodeSample, WTF_ARRAY_LENGTH(unicodeSample))));
500 } 500 }
501 501
502 } // namespace WTF 502 } // namespace WTF
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/text/WTFString.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698