OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // This file tests the C++ Mojo system macros and consists of "positive" tests, | 5 // This file tests the C++ Mojo system macros and consists of "positive" tests, |
6 // i.e., those verifying that things work (without compile errors, or even | 6 // i.e., those verifying that things work (without compile errors, or even |
7 // warnings if warnings are treated as errors). | 7 // warnings if warnings are treated as errors). |
8 // TODO(vtl): Maybe rename "MacrosCppTest" -> "MacrosTest" if/when this gets | 8 // TODO(vtl): Maybe rename "MacrosCppTest" -> "MacrosTest" if/when this gets |
9 // compiled into a different binary from the C API tests. | 9 // compiled into a different binary from the C API tests. |
10 // TODO(vtl): Fix no-compile tests (which are all disabled; crbug.com/105388) | 10 // TODO(vtl): Fix no-compile tests (which are all disabled; crbug.com/105388) |
(...skipping 13 matching lines...) Expand all Loading... |
24 // Note: MSVS is very strict (and arguably buggy) about warnings for classes | 24 // Note: MSVS is very strict (and arguably buggy) about warnings for classes |
25 // defined in a local scope, so define these globally. | 25 // defined in a local scope, so define these globally. |
26 struct TestOverrideBaseClass { | 26 struct TestOverrideBaseClass { |
27 virtual ~TestOverrideBaseClass() {} | 27 virtual ~TestOverrideBaseClass() {} |
28 virtual void ToBeOverridden() {} | 28 virtual void ToBeOverridden() {} |
29 virtual void AlsoToBeOverridden() = 0; | 29 virtual void AlsoToBeOverridden() = 0; |
30 }; | 30 }; |
31 | 31 |
32 struct TestOverrideSubclass : public TestOverrideBaseClass { | 32 struct TestOverrideSubclass : public TestOverrideBaseClass { |
33 virtual ~TestOverrideSubclass() {} | 33 virtual ~TestOverrideSubclass() {} |
34 virtual void ToBeOverridden() MOJO_OVERRIDE {} | 34 virtual void ToBeOverridden() override {} |
35 virtual void AlsoToBeOverridden() MOJO_OVERRIDE {} | 35 virtual void AlsoToBeOverridden() override {} |
36 }; | 36 }; |
37 | 37 |
38 TEST(MacrosCppTest, Override) { | 38 TEST(MacrosCppTest, Override) { |
39 TestOverrideSubclass x; | 39 TestOverrideSubclass x; |
40 x.ToBeOverridden(); | 40 x.ToBeOverridden(); |
41 x.AlsoToBeOverridden(); | 41 x.AlsoToBeOverridden(); |
42 } | 42 } |
43 | 43 |
44 // Note: MSVS is very strict (and arguably buggy) about warnings for classes | 44 // Note: MSVS is very strict (and arguably buggy) about warnings for classes |
45 // defined in a local scope, so define these globally. | 45 // defined in a local scope, so define these globally. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 EXPECT_FALSE(y.is_set()); | 116 EXPECT_FALSE(y.is_set()); |
117 EXPECT_TRUE(z.is_set()); | 117 EXPECT_TRUE(z.is_set()); |
118 EXPECT_EQ(123, z.value()); | 118 EXPECT_EQ(123, z.value()); |
119 z = z.Pass(); | 119 z = z.Pass(); |
120 EXPECT_TRUE(z.is_set()); | 120 EXPECT_TRUE(z.is_set()); |
121 EXPECT_EQ(123, z.value()); | 121 EXPECT_EQ(123, z.value()); |
122 } | 122 } |
123 | 123 |
124 } // namespace | 124 } // namespace |
125 } // namespace mojo | 125 } // namespace mojo |
OLD | NEW |