| 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/CSSResourceValue.h" | 5 #include "core/css/cssom/CSSResourceValue.h" |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 class FakeCSSResourceValue : public CSSResourceValue { | 13 class FakeCSSResourceValue : public CSSResourceValue { |
| 14 public: | 14 public: |
| 15 FakeCSSResourceValue(ResourceStatus status) : status_(status) {} | 15 FakeCSSResourceValue(ResourceStatus status) : status_(status) {} |
| 16 ResourceStatus Status() const override { return status_; } | 16 ResourceStatus Status() const override { return status_; } |
| 17 | 17 |
| 18 CSSValue* ToCSSValue() const override { return nullptr; } | 18 CSSValue* ToCSSValue() const override { return nullptr; } |
| 19 StyleValueType GetType() const override { return kUnknown; } | 19 StyleValueType GetType() const override { return kUnknownType; } |
| 20 | 20 |
| 21 private: | 21 private: |
| 22 ResourceStatus status_; | 22 ResourceStatus status_; |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 } // namespace | 25 } // namespace |
| 26 | 26 |
| 27 TEST(CSSResourceValueTest, TestStatus) { | 27 TEST(CSSResourceValueTest, TestStatus) { |
| 28 EXPECT_EQ((new FakeCSSResourceValue(ResourceStatus::kNotStarted))->state(), | 28 EXPECT_EQ((new FakeCSSResourceValue(ResourceStatus::kNotStarted))->state(), |
| 29 "unloaded"); | 29 "unloaded"); |
| 30 EXPECT_EQ((new FakeCSSResourceValue(ResourceStatus::kPending))->state(), | 30 EXPECT_EQ((new FakeCSSResourceValue(ResourceStatus::kPending))->state(), |
| 31 "loading"); | 31 "loading"); |
| 32 EXPECT_EQ((new FakeCSSResourceValue(ResourceStatus::kCached))->state(), | 32 EXPECT_EQ((new FakeCSSResourceValue(ResourceStatus::kCached))->state(), |
| 33 "loaded"); | 33 "loaded"); |
| 34 EXPECT_EQ((new FakeCSSResourceValue(ResourceStatus::kLoadError))->state(), | 34 EXPECT_EQ((new FakeCSSResourceValue(ResourceStatus::kLoadError))->state(), |
| 35 "error"); | 35 "error"); |
| 36 EXPECT_EQ((new FakeCSSResourceValue(ResourceStatus::kDecodeError))->state(), | 36 EXPECT_EQ((new FakeCSSResourceValue(ResourceStatus::kDecodeError))->state(), |
| 37 "error"); | 37 "error"); |
| 38 } | 38 } |
| 39 | 39 |
| 40 } // namespace blink | 40 } // namespace blink |
| OLD | NEW |