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 "ash/wm/frame_painter.h" | 5 #include "ash/wm/frame_painter.h" |
6 | 6 |
7 #include "ash/ash_constants.h" | 7 #include "ash/ash_constants.h" |
| 8 #include "ash/root_window_property.h" |
8 #include "ash/shell.h" | 9 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
10 #include "ash/test/ash_test_base.h" | 11 #include "ash/test/ash_test_base.h" |
11 #include "ash/wm/property_util.h" | 12 #include "ash/wm/property_util.h" |
12 #include "ash/wm/window_properties.h" | |
13 #include "ash/wm/window_util.h" | 13 #include "ash/wm/window_util.h" |
14 #include "ash/wm/workspace/frame_caption_button_container_view.h" | 14 #include "ash/wm/workspace/frame_caption_button_container_view.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
17 #include "grit/ash_resources.h" | 17 #include "grit/ash_resources.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "ui/aura/client/aura_constants.h" | 19 #include "ui/aura/client/aura_constants.h" |
20 #include "ui/aura/root_window.h" | 20 #include "ui/aura/root_window.h" |
21 #include "ui/aura/window_observer.h" | 21 #include "ui/aura/window_observer.h" |
22 #include "ui/base/hit_test.h" | 22 #include "ui/base/hit_test.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 // Ensure that creating/deleting a window works well and doesn't cause | 209 // Ensure that creating/deleting a window works well and doesn't cause |
210 // crashes. See crbug.com/155634 | 210 // crashes. See crbug.com/155634 |
211 aura::RootWindow* root = Shell::GetActiveRootWindow(); | 211 aura::RootWindow* root = Shell::GetActiveRootWindow(); |
212 | 212 |
213 scoped_ptr<Widget> widget(CreateTestWidget()); | 213 scoped_ptr<Widget> widget(CreateTestWidget()); |
214 scoped_ptr<FramePainter> painter(CreateTestPainter(widget.get())); | 214 scoped_ptr<FramePainter> painter(CreateTestPainter(widget.get())); |
215 widget->Show(); | 215 widget->Show(); |
216 | 216 |
217 // We only have one window, so it should use a solo header. | 217 // We only have one window, so it should use a solo header. |
218 EXPECT_TRUE(painter->UseSoloWindowHeader()); | 218 EXPECT_TRUE(painter->UseSoloWindowHeader()); |
219 EXPECT_TRUE(root->GetProperty(internal::kSoloWindowHeaderKey)); | 219 EXPECT_TRUE(internal::GetRootWindowProperty(root)->solo_window_header); |
220 | 220 |
221 // Close the window. | 221 // Close the window. |
222 widget.reset(); | 222 widget.reset(); |
223 EXPECT_FALSE(root->GetProperty(internal::kSoloWindowHeaderKey)); | 223 EXPECT_FALSE(internal::GetRootWindowProperty(root)->solo_window_header); |
224 | 224 |
225 // Recreate another window again. | 225 // Recreate another window again. |
226 widget.reset(CreateTestWidget()); | 226 widget.reset(CreateTestWidget()); |
227 painter.reset(CreateTestPainter(widget.get())); | 227 painter.reset(CreateTestPainter(widget.get())); |
228 widget->Show(); | 228 widget->Show(); |
229 EXPECT_TRUE(painter->UseSoloWindowHeader()); | 229 EXPECT_TRUE(painter->UseSoloWindowHeader()); |
230 EXPECT_TRUE(root->GetProperty(internal::kSoloWindowHeaderKey)); | 230 EXPECT_TRUE(internal::GetRootWindowProperty(root)->solo_window_header); |
231 } | 231 } |
232 | 232 |
233 TEST_F(FramePainterTest, UseSoloWindowHeader) { | 233 TEST_F(FramePainterTest, UseSoloWindowHeader) { |
234 // Create a widget and a painter for it. | 234 // Create a widget and a painter for it. |
235 scoped_ptr<Widget> w1(CreateTestWidget()); | 235 scoped_ptr<Widget> w1(CreateTestWidget()); |
236 scoped_ptr<FramePainter> p1(CreateTestPainter(w1.get())); | 236 scoped_ptr<FramePainter> p1(CreateTestPainter(w1.get())); |
237 w1->Show(); | 237 w1->Show(); |
238 | 238 |
239 // We only have one window, so it should use a solo header. | 239 // We only have one window, so it should use a solo header. |
240 EXPECT_TRUE(p1->UseSoloWindowHeader()); | 240 EXPECT_TRUE(p1->UseSoloWindowHeader()); |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 FramePainterOwner* o2 = new FramePainterOwner(w2); | 654 FramePainterOwner* o2 = new FramePainterOwner(w2); |
655 FramePainter* p2 = o2->frame_painter(); | 655 FramePainter* p2 = o2->frame_painter(); |
656 w2->Show(); | 656 w2->Show(); |
657 EXPECT_FALSE(p1->UseSoloWindowHeader()); | 657 EXPECT_FALSE(p1->UseSoloWindowHeader()); |
658 EXPECT_FALSE(p2->UseSoloWindowHeader()); | 658 EXPECT_FALSE(p2->UseSoloWindowHeader()); |
659 | 659 |
660 // Exit with no resource release. They'll be released at shutdown. | 660 // Exit with no resource release. They'll be released at shutdown. |
661 } | 661 } |
662 | 662 |
663 } // namespace ash | 663 } // namespace ash |
OLD | NEW |