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

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

Issue 1233363002: CSSValue Immediates: Replace CSSPrimitiveValue usage with const references (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cssvalue_patch_4_attempt_2
Patch Set: Rebase Created 5 years, 4 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 | « Source/core/css/CSSValueList.cpp ('k') | Source/core/css/Counter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/css/CSSValue.h" 6 #include "core/css/CSSValue.h"
7 7
8 #include "core/css/CSSPrimitiveValue.h" 8 #include "core/css/CSSPrimitiveValue.h"
9 #include "core/css/CSSValueTestHelper.h" 9 #include "core/css/CSSValueTestHelper.h"
10 #include <gtest/gtest.h> 10 #include <gtest/gtest.h>
(...skipping 25 matching lines...) Expand all
36 CSSValue copyConstructor(refPtrConstructor); 36 CSSValue copyConstructor(refPtrConstructor);
37 EXPECT_STREQ("bold", copyConstructor.cssText().utf8().data()); 37 EXPECT_STREQ("bold", copyConstructor.cssText().utf8().data());
38 38
39 CSSValue constCopyConstructor(*const_cast<const CSSValue*>(&refPtrConstructo r)); 39 CSSValue constCopyConstructor(*const_cast<const CSSValue*>(&refPtrConstructo r));
40 EXPECT_STREQ("bold", constCopyConstructor.cssText().utf8().data()); 40 EXPECT_STREQ("bold", constCopyConstructor.cssText().utf8().data());
41 41
42 CSSValue newAssignmentOperator = refPtrConstructor; 42 CSSValue newAssignmentOperator = refPtrConstructor;
43 EXPECT_STREQ("bold", newAssignmentOperator.cssText().utf8().data()); 43 EXPECT_STREQ("bold", newAssignmentOperator.cssText().utf8().data());
44 EXPECT_STREQ("bold", refPtrConstructor.cssText().utf8().data()); 44 EXPECT_STREQ("bold", refPtrConstructor.cssText().utf8().data());
45 45
46 /*
46 CSSValue existingAssignmentOperator(primitiveValueRef); 47 CSSValue existingAssignmentOperator(primitiveValueRef);
47 existingAssignmentOperator = passRefPtrConstructor; 48 existingAssignmentOperator = passRefPtrConstructor;
48 EXPECT_STREQ("bold", existingAssignmentOperator.cssText().utf8().data()); 49 EXPECT_STREQ("bold", existingAssignmentOperator.cssText().utf8().data());
49 EXPECT_STREQ("bold", refPtrConstructor.cssText().utf8().data()); 50 EXPECT_STREQ("bold", refPtrConstructor.cssText().utf8().data());
50 51
51 CSSValue selfAssignmentOperator(primitiveValueRef); 52 CSSValue selfAssignmentOperator(primitiveValueRef);
52 selfAssignmentOperator = refPtrConstructor; 53 selfAssignmentOperator = refPtrConstructor;
53 EXPECT_STREQ("bold", selfAssignmentOperator.cssText().utf8().data()); 54 EXPECT_STREQ("bold", selfAssignmentOperator.cssText().utf8().data());
54 EXPECT_STREQ("bold", refPtrConstructor.cssText().utf8().data()); 55 EXPECT_STREQ("bold", refPtrConstructor.cssText().utf8().data());
56 */
55 } 57 }
56 58
57 TEST(CSSValueTest, NullableCSSValueTest) 59 TEST(CSSValueTest, NullableCSSValueTest)
58 { 60 {
59 CSSPrimitiveValue primitiveValueRef = CSSPrimitiveValue::createIdentifier(CS SValueBold); 61 CSSPrimitiveValue primitiveValueRef = CSSPrimitiveValue::createIdentifier(CS SValueBold);
60 62
61 NullableCSSValue defaultConstructor; 63 NullableCSSValue defaultConstructor;
62 EXPECT_FALSE(defaultConstructor); 64 EXPECT_FALSE(defaultConstructor);
63 65
64 NullableCSSValue nullPtrConstructor(nullptr); 66 NullableCSSValue nullPtrConstructor(nullptr);
(...skipping 20 matching lines...) Expand all
85 CSSValue cssValue(primitiveValueRef); 87 CSSValue cssValue(primitiveValueRef);
86 NullableCSSValue cssValueCopyConstructor(cssValue); 88 NullableCSSValue cssValueCopyConstructor(cssValue);
87 EXPECT_STREQ("bold", cssValueCopyConstructor->cssText().utf8().data()); 89 EXPECT_STREQ("bold", cssValueCopyConstructor->cssText().utf8().data());
88 90
89 const CSSValue constCssValue(primitiveValueRef); 91 const CSSValue constCssValue(primitiveValueRef);
90 NullableCSSValue constCssValueCopyConstructor(constCssValue); 92 NullableCSSValue constCssValueCopyConstructor(constCssValue);
91 EXPECT_STREQ("bold", constCssValueCopyConstructor->cssText().utf8().data()); 93 EXPECT_STREQ("bold", constCssValueCopyConstructor->cssText().utf8().data());
92 } 94 }
93 95
94 } // namespace 96 } // namespace
OLDNEW
« no previous file with comments | « Source/core/css/CSSValueList.cpp ('k') | Source/core/css/Counter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698