| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "ui/base/view_prop.h" | 8 #include "ui/base/view_prop.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| 11 const char kKey1[] = "key_1"; | 11 const char kKey1[] = "key_1"; |
| 12 const char kKey2[] = "key_2"; | 12 const char kKey2[] = "key_2"; |
| 13 } // namespace | 13 } // namespace |
| 14 | 14 |
| 15 namespace ui { | 15 namespace ui { |
| 16 | 16 |
| 17 // Test a handful of viewprop assertions. | 17 // Test a handful of viewprop assertions. |
| 18 TEST(ViewPropTest, Basic) { | 18 TEST(ViewPropTest, Basic) { |
| 19 gfx::NativeView nv1 = reinterpret_cast<gfx::NativeView>(1); | 19 gfx::AcceleratedWidget nv1 = reinterpret_cast<gfx::AcceleratedWidget>(1); |
| 20 gfx::NativeView nv2 = reinterpret_cast<gfx::NativeView>(2); | 20 gfx::AcceleratedWidget nv2 = reinterpret_cast<gfx::AcceleratedWidget>(2); |
| 21 | 21 |
| 22 void* data1 = reinterpret_cast<void*>(11); | 22 void* data1 = reinterpret_cast<void*>(11); |
| 23 void* data2 = reinterpret_cast<void*>(12); | 23 void* data2 = reinterpret_cast<void*>(12); |
| 24 | 24 |
| 25 // Initial value for a new view/key pair should be NULL. | 25 // Initial value for a new view/key pair should be NULL. |
| 26 EXPECT_EQ(NULL, ViewProp::GetValue(nv1, kKey1)); | 26 EXPECT_EQ(NULL, ViewProp::GetValue(nv1, kKey1)); |
| 27 | 27 |
| 28 { | 28 { |
| 29 // Register a value for a view/key pair. | 29 // Register a value for a view/key pair. |
| 30 ViewProp prop(nv1, kKey1, data1); | 30 ViewProp prop(nv1, kKey1, data1); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 EXPECT_EQ(NULL, ViewProp::GetValue(nv1, kKey1)); | 63 EXPECT_EQ(NULL, ViewProp::GetValue(nv1, kKey1)); |
| 64 EXPECT_EQ(data2, ViewProp::GetValue(nv2, kKey2)); | 64 EXPECT_EQ(data2, ViewProp::GetValue(nv2, kKey2)); |
| 65 | 65 |
| 66 v2.reset(NULL); | 66 v2.reset(NULL); |
| 67 EXPECT_EQ(NULL, ViewProp::GetValue(nv1, kKey1)); | 67 EXPECT_EQ(NULL, ViewProp::GetValue(nv1, kKey1)); |
| 68 EXPECT_EQ(NULL, ViewProp::GetValue(nv2, kKey2)); | 68 EXPECT_EQ(NULL, ViewProp::GetValue(nv2, kKey2)); |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 } // namespace ui | 72 } // namespace ui |
| OLD | NEW |