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

Side by Side Diff: Source/core/css/CSSParserValuesTest.cpp

Issue 189843005: CSSParserString::equalIgnoringCase should check string length. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed linux_debug failure. Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/CSSParserValues.h ('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 2013, Google Inc. All rights reserved. 2 * Copyright 2013, Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 TEST(CSSParserValuesTest, InitWithEmpty16BitsString) 49 TEST(CSSParserValuesTest, InitWithEmpty16BitsString)
50 { 50 {
51 String string16bit("a"); 51 String string16bit("a");
52 string16bit.ensure16Bit(); 52 string16bit.ensure16Bit();
53 53
54 CSSParserString cssParserString; 54 CSSParserString cssParserString;
55 cssParserString.init(string16bit, 1, 0); 55 cssParserString.init(string16bit, 1, 0);
56 ASSERT_EQ(0u, cssParserString.length()); 56 ASSERT_EQ(0u, cssParserString.length());
57 } 57 }
58 58
59 TEST(CSSParserValuesTest, EqualIgnoringCase8BitsString)
60 {
61 CSSParserString cssParserString;
62 String string8bit("sHaDOw");
63 cssParserString.init(string8bit, 0, string8bit.length());
64
65 ASSERT_TRUE(cssParserString.equalIgnoringCase("shadow"));
66 ASSERT_TRUE(cssParserString.equalIgnoringCase("ShaDow"));
67 ASSERT_FALSE(cssParserString.equalIgnoringCase("shadow-all"));
68 ASSERT_FALSE(cssParserString.equalIgnoringCase("sha"));
69 ASSERT_FALSE(cssParserString.equalIgnoringCase("abCD"));
70 }
71
72 TEST(CSSParserValuesTest, EqualIgnoringCase16BitsString)
73 {
74 String string16bit("sHaDOw");
75 string16bit.ensure16Bit();
76
77 CSSParserString cssParserString;
78 cssParserString.init(string16bit, 0, string16bit.length());
79
80 ASSERT_TRUE(cssParserString.equalIgnoringCase("shadow"));
81 ASSERT_TRUE(cssParserString.equalIgnoringCase("ShaDow"));
82 ASSERT_FALSE(cssParserString.equalIgnoringCase("shadow-all"));
83 ASSERT_FALSE(cssParserString.equalIgnoringCase("sha"));
84 ASSERT_FALSE(cssParserString.equalIgnoringCase("abCD"));
85 }
86
59 } // namespace 87 } // namespace
OLDNEW
« no previous file with comments | « Source/core/css/CSSParserValues.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698