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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "components/mus/common/util.h" | 10 #include "components/mus/common/util.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 w1.AddChild(&w11); | 116 w1.AddChild(&w11); |
117 EXPECT_TRUE(w11.visible()); | 117 EXPECT_TRUE(w11.visible()); |
118 EXPECT_TRUE(w11.IsDrawn()); | 118 EXPECT_TRUE(w11.IsDrawn()); |
119 | 119 |
120 w1.RemoveChild(&w11); | 120 w1.RemoveChild(&w11); |
121 EXPECT_TRUE(w11.visible()); | 121 EXPECT_TRUE(w11.visible()); |
122 EXPECT_FALSE(w11.IsDrawn()); | 122 EXPECT_FALSE(w11.IsDrawn()); |
123 } | 123 } |
124 | 124 |
125 namespace { | 125 namespace { |
126 DEFINE_WINDOW_PROPERTY_KEY(int, kIntKey, -2); | 126 MUS_DEFINE_WINDOW_PROPERTY_KEY(int, kIntKey, -2); |
127 DEFINE_WINDOW_PROPERTY_KEY(const char*, kStringKey, "squeamish"); | 127 MUS_DEFINE_WINDOW_PROPERTY_KEY(const char*, kStringKey, "squeamish"); |
128 } | 128 } |
129 | 129 |
130 TEST_F(WindowTest, Property) { | 130 TEST_F(WindowTest, Property) { |
131 TestWindow w; | 131 TestWindow w; |
132 | 132 |
133 // Non-existent properties should return the default walues. | 133 // Non-existent properties should return the default walues. |
134 EXPECT_EQ(-2, w.GetLocalProperty(kIntKey)); | 134 EXPECT_EQ(-2, w.GetLocalProperty(kIntKey)); |
135 EXPECT_EQ(std::string("squeamish"), w.GetLocalProperty(kStringKey)); | 135 EXPECT_EQ(std::string("squeamish"), w.GetLocalProperty(kStringKey)); |
136 | 136 |
137 // A set property walue should be returned again (even if it's the default | 137 // A set property walue should be returned again (even if it's the default |
(...skipping 27 matching lines...) Expand all Loading... |
165 virtual ~TestProperty() { last_deleted_ = this; } | 165 virtual ~TestProperty() { last_deleted_ = this; } |
166 static TestProperty* last_deleted() { return last_deleted_; } | 166 static TestProperty* last_deleted() { return last_deleted_; } |
167 | 167 |
168 private: | 168 private: |
169 static TestProperty* last_deleted_; | 169 static TestProperty* last_deleted_; |
170 MOJO_DISALLOW_COPY_AND_ASSIGN(TestProperty); | 170 MOJO_DISALLOW_COPY_AND_ASSIGN(TestProperty); |
171 }; | 171 }; |
172 | 172 |
173 TestProperty* TestProperty::last_deleted_ = NULL; | 173 TestProperty* TestProperty::last_deleted_ = NULL; |
174 | 174 |
175 DEFINE_OWNED_WINDOW_PROPERTY_KEY(TestProperty, kOwnedKey, NULL); | 175 MUS_DEFINE_OWNED_WINDOW_PROPERTY_KEY(TestProperty, kOwnedKey, NULL); |
176 | 176 |
177 } // namespace | 177 } // namespace |
178 | 178 |
179 TEST_F(WindowTest, OwnedProperty) { | 179 TEST_F(WindowTest, OwnedProperty) { |
180 TestProperty* p3 = NULL; | 180 TestProperty* p3 = NULL; |
181 { | 181 { |
182 TestWindow w; | 182 TestWindow w; |
183 EXPECT_EQ(NULL, w.GetLocalProperty(kOwnedKey)); | 183 EXPECT_EQ(NULL, w.GetLocalProperty(kOwnedKey)); |
184 TestProperty* p1 = new TestProperty(); | 184 TestProperty* p1 = new TestProperty(); |
185 w.SetLocalProperty(kOwnedKey, p1); | 185 w.SetLocalProperty(kOwnedKey, p1); |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 scoped_ptr<TestWindow> window0(CreateTestWindow(1, parent.get())); | 1113 scoped_ptr<TestWindow> window0(CreateTestWindow(1, parent.get())); |
1114 scoped_ptr<TestWindow> window1(CreateTestWindow(2, parent.get())); | 1114 scoped_ptr<TestWindow> window1(CreateTestWindow(2, parent.get())); |
1115 | 1115 |
1116 TestWindow* window2 = CreateTestWindow(3, parent.get()); | 1116 TestWindow* window2 = CreateTestWindow(3, parent.get()); |
1117 | 1117 |
1118 window0->AddTransientWindow(window2); | 1118 window0->AddTransientWindow(window2); |
1119 EXPECT_EQ("1 3 2", ChildWindowIDsAsString(parent.get())); | 1119 EXPECT_EQ("1 3 2", ChildWindowIDsAsString(parent.get())); |
1120 } | 1120 } |
1121 | 1121 |
1122 } // namespace mus | 1122 } // namespace mus |
OLD | NEW |