OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "extensions/browser/api/declarative/deduping_factory.h" | 5 #include "extensions/browser/api/declarative/deduping_factory.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 20 matching lines...) Expand all Loading... |
31 friend class base::RefCounted<BaseClass>; | 31 friend class base::RefCounted<BaseClass>; |
32 virtual ~BaseClass() {} | 32 virtual ~BaseClass() {} |
33 | 33 |
34 private: | 34 private: |
35 const Type type_; | 35 const Type type_; |
36 }; | 36 }; |
37 | 37 |
38 class Foo : public BaseClass { | 38 class Foo : public BaseClass { |
39 public: | 39 public: |
40 explicit Foo(int parameter) : BaseClass(FOO), parameter_(parameter) {} | 40 explicit Foo(int parameter) : BaseClass(FOO), parameter_(parameter) {} |
41 virtual bool Equals(const BaseClass* other) const OVERRIDE { | 41 virtual bool Equals(const BaseClass* other) const override { |
42 return other->type() == type() && | 42 return other->type() == type() && |
43 static_cast<const Foo*>(other)->parameter_ == parameter_; | 43 static_cast<const Foo*>(other)->parameter_ == parameter_; |
44 } | 44 } |
45 int parameter() const { | 45 int parameter() const { |
46 return parameter_; | 46 return parameter_; |
47 } | 47 } |
48 | 48 |
49 private: | 49 private: |
50 friend class base::RefCounted<BaseClass>; | 50 friend class base::RefCounted<BaseClass>; |
51 virtual ~Foo() {} | 51 virtual ~Foo() {} |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 scoped_refptr<const BaseClass> c1_b( | 191 scoped_refptr<const BaseClass> c1_b( |
192 factory.Instantiate(kTypeName, d1.get(), &error, &bad_message)); | 192 factory.Instantiate(kTypeName, d1.get(), &error, &bad_message)); |
193 | 193 |
194 ASSERT_TRUE(c1_a.get()); | 194 ASSERT_TRUE(c1_a.get()); |
195 ASSERT_TRUE(c1_b.get()); | 195 ASSERT_TRUE(c1_b.get()); |
196 EXPECT_NE(c1_a, c1_b); | 196 EXPECT_NE(c1_a, c1_b); |
197 } | 197 } |
198 | 198 |
199 } // namespace extensions | 199 } // namespace extensions |
OLD | NEW |