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 #include "components/mus/public/cpp/window.h" | 5 #include "components/mus/public/cpp/window.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 w1.AddChild(&w11); | 123 w1.AddChild(&w11); |
124 EXPECT_TRUE(w11.visible()); | 124 EXPECT_TRUE(w11.visible()); |
125 EXPECT_TRUE(w11.IsDrawn()); | 125 EXPECT_TRUE(w11.IsDrawn()); |
126 | 126 |
127 w1.RemoveChild(&w11); | 127 w1.RemoveChild(&w11); |
128 EXPECT_TRUE(w11.visible()); | 128 EXPECT_TRUE(w11.visible()); |
129 EXPECT_FALSE(w11.IsDrawn()); | 129 EXPECT_FALSE(w11.IsDrawn()); |
130 } | 130 } |
131 | 131 |
132 namespace { | 132 namespace { |
133 DEFINE_WINDOW_PROPERTY_KEY(int, kIntKey, -2); | 133 MUS_DEFINE_WINDOW_PROPERTY_KEY(int, kIntKey, -2); |
134 DEFINE_WINDOW_PROPERTY_KEY(const char*, kStringKey, "squeamish"); | 134 MUS_DEFINE_WINDOW_PROPERTY_KEY(const char*, kStringKey, "squeamish"); |
135 } | 135 } |
136 | 136 |
137 TEST_F(WindowTest, Property) { | 137 TEST_F(WindowTest, Property) { |
138 TestWindow w; | 138 TestWindow w; |
139 | 139 |
140 // Non-existent properties should return the default walues. | 140 // Non-existent properties should return the default walues. |
141 EXPECT_EQ(-2, w.GetLocalProperty(kIntKey)); | 141 EXPECT_EQ(-2, w.GetLocalProperty(kIntKey)); |
142 EXPECT_EQ(std::string("squeamish"), w.GetLocalProperty(kStringKey)); | 142 EXPECT_EQ(std::string("squeamish"), w.GetLocalProperty(kStringKey)); |
143 | 143 |
144 // A set property walue should be returned again (even if it's the default | 144 // A set property walue should be returned again (even if it's the default |
(...skipping 27 matching lines...) Expand all Loading... |
172 virtual ~TestProperty() { last_deleted_ = this; } | 172 virtual ~TestProperty() { last_deleted_ = this; } |
173 static TestProperty* last_deleted() { return last_deleted_; } | 173 static TestProperty* last_deleted() { return last_deleted_; } |
174 | 174 |
175 private: | 175 private: |
176 static TestProperty* last_deleted_; | 176 static TestProperty* last_deleted_; |
177 MOJO_DISALLOW_COPY_AND_ASSIGN(TestProperty); | 177 MOJO_DISALLOW_COPY_AND_ASSIGN(TestProperty); |
178 }; | 178 }; |
179 | 179 |
180 TestProperty* TestProperty::last_deleted_ = NULL; | 180 TestProperty* TestProperty::last_deleted_ = NULL; |
181 | 181 |
182 DEFINE_OWNED_WINDOW_PROPERTY_KEY(TestProperty, kOwnedKey, NULL); | 182 MUS_DEFINE_OWNED_WINDOW_PROPERTY_KEY(TestProperty, kOwnedKey, NULL); |
183 | 183 |
184 } // namespace | 184 } // namespace |
185 | 185 |
186 TEST_F(WindowTest, OwnedProperty) { | 186 TEST_F(WindowTest, OwnedProperty) { |
187 TestProperty* p3 = NULL; | 187 TestProperty* p3 = NULL; |
188 { | 188 { |
189 TestWindow w; | 189 TestWindow w; |
190 EXPECT_EQ(NULL, w.GetLocalProperty(kOwnedKey)); | 190 EXPECT_EQ(NULL, w.GetLocalProperty(kOwnedKey)); |
191 TestProperty* p1 = new TestProperty(); | 191 TestProperty* p1 = new TestProperty(); |
192 w.SetLocalProperty(kOwnedKey, p1); | 192 w.SetLocalProperty(kOwnedKey, p1); |
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1126 scoped_ptr<TestWindow> window0(CreateTestWindow(1, parent.get())); | 1126 scoped_ptr<TestWindow> window0(CreateTestWindow(1, parent.get())); |
1127 scoped_ptr<TestWindow> window1(CreateTestWindow(2, parent.get())); | 1127 scoped_ptr<TestWindow> window1(CreateTestWindow(2, parent.get())); |
1128 | 1128 |
1129 TestWindow* window2 = CreateTestWindow(3, parent.get()); | 1129 TestWindow* window2 = CreateTestWindow(3, parent.get()); |
1130 | 1130 |
1131 window0->AddTransientWindow(window2); | 1131 window0->AddTransientWindow(window2); |
1132 EXPECT_EQ("1 3 2", ChildWindowIDsAsString(parent.get())); | 1132 EXPECT_EQ("1 3 2", ChildWindowIDsAsString(parent.get())); |
1133 } | 1133 } |
1134 | 1134 |
1135 } // namespace mus | 1135 } // namespace mus |
OLD | NEW |