| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/css/cssom/CSSStyleVariableReferenceValue.h" | 5 #include "core/css/cssom/CSSStyleVariableReferenceValue.h" |
| 6 | 6 |
| 7 #include "core/css/cssom/CSSUnparsedValue.h" | 7 #include "core/css/cssom/CSSUnparsedValue.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 TEST(CSSVariableReferenceValueTest, EmptyList) { | 12 TEST(CSSVariableReferenceValueTest, EmptyList) { |
| 13 HeapVector<StringOrCSSVariableReferenceValue> fragments; | 13 HeapVector<StringOrCSSVariableReferenceValue> fragments; |
| 14 CSSUnparsedValue* unparsedValue = CSSUnparsedValue::create(fragments); | 14 CSSUnparsedValue* unparsedValue = CSSUnparsedValue::create(fragments); |
| 15 | 15 |
| 16 CSSStyleVariableReferenceValue* variableReferenceValue = | 16 CSSStyleVariableReferenceValue* variableReferenceValue = |
| 17 CSSStyleVariableReferenceValue::create("test", unparsedValue); | 17 CSSStyleVariableReferenceValue::create("test", unparsedValue); |
| 18 | 18 |
| 19 EXPECT_EQ(variableReferenceValue->variable(), "test"); | 19 EXPECT_EQ(variableReferenceValue->variable(), "test"); |
| 20 EXPECT_EQ(variableReferenceValue->fallback(), unparsedValue); | 20 EXPECT_EQ(variableReferenceValue->fallback(), unparsedValue); |
| 21 } | 21 } |
| 22 | 22 |
| 23 TEST(CSSVariableReferenceValueTest, MixedList) { | 23 TEST(CSSVariableReferenceValueTest, MixedList) { |
| 24 HeapVector<StringOrCSSVariableReferenceValue> fragments; | 24 HeapVector<StringOrCSSVariableReferenceValue> fragments; |
| 25 fragments.append(StringOrCSSVariableReferenceValue::fromString("string")); | 25 fragments.push_back(StringOrCSSVariableReferenceValue::fromString("string")); |
| 26 fragments.append( | 26 fragments.push_back( |
| 27 StringOrCSSVariableReferenceValue::fromCSSVariableReferenceValue( | 27 StringOrCSSVariableReferenceValue::fromCSSVariableReferenceValue( |
| 28 CSSStyleVariableReferenceValue::create( | 28 CSSStyleVariableReferenceValue::create( |
| 29 "Variable", CSSUnparsedValue::fromString("Fallback")))); | 29 "Variable", CSSUnparsedValue::fromString("Fallback")))); |
| 30 fragments.append(StringOrCSSVariableReferenceValue()); | 30 fragments.push_back(StringOrCSSVariableReferenceValue()); |
| 31 | 31 |
| 32 CSSUnparsedValue* unparsedValue = CSSUnparsedValue::create(fragments); | 32 CSSUnparsedValue* unparsedValue = CSSUnparsedValue::create(fragments); |
| 33 | 33 |
| 34 CSSStyleVariableReferenceValue* variableReferenceValue = | 34 CSSStyleVariableReferenceValue* variableReferenceValue = |
| 35 CSSStyleVariableReferenceValue::create("test", unparsedValue); | 35 CSSStyleVariableReferenceValue::create("test", unparsedValue); |
| 36 | 36 |
| 37 EXPECT_EQ(variableReferenceValue->variable(), "test"); | 37 EXPECT_EQ(variableReferenceValue->variable(), "test"); |
| 38 EXPECT_EQ(variableReferenceValue->fallback(), unparsedValue); | 38 EXPECT_EQ(variableReferenceValue->fallback(), unparsedValue); |
| 39 } | 39 } |
| 40 | 40 |
| 41 } // namespace blink | 41 } // namespace blink |
| OLD | NEW |