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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/i18n/icu_util.h" | 7 #include "base/i18n/icu_util.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "third_party/skia/include/core/SkXfermode.h" | 10 #include "third_party/skia/include/core/SkXfermode.h" |
11 #include "ui/aura/desktop.h" | 11 #include "ui/aura/desktop.h" |
12 #include "ui/aura/event.h" | 12 #include "ui/aura/event.h" |
13 #include "ui/aura/hit_test.h" | 13 #include "ui/aura/hit_test.h" |
14 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
15 #include "ui/aura/window_delegate.h" | 15 #include "ui/aura/window_delegate.h" |
16 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
17 #include "ui/base/ui_base_paths.h" | 17 #include "ui/base/ui_base_paths.h" |
18 #include "ui/gfx/canvas_skia.h" | 18 #include "ui/gfx/canvas_skia.h" |
| 19 #include "ui/gfx/compositor/compositor_test_support.h" |
19 #include "ui/gfx/rect.h" | 20 #include "ui/gfx/rect.h" |
20 | 21 |
21 #if defined(USE_X11) | 22 #if defined(USE_X11) |
22 #include "base/message_pump_x.h" | 23 #include "base/message_pump_x.h" |
23 #endif | 24 #endif |
24 | 25 |
25 namespace { | 26 namespace { |
26 | 27 |
27 // Trivial WindowDelegate implementation that draws a colored background. | 28 // Trivial WindowDelegate implementation that draws a colored background. |
28 class DemoWindowDelegate : public aura::WindowDelegate { | 29 class DemoWindowDelegate : public aura::WindowDelegate { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 75 |
75 // The exit manager is in charge of calling the dtors of singleton objects. | 76 // The exit manager is in charge of calling the dtors of singleton objects. |
76 base::AtExitManager exit_manager; | 77 base::AtExitManager exit_manager; |
77 | 78 |
78 ui::RegisterPathProvider(); | 79 ui::RegisterPathProvider(); |
79 icu_util::Initialize(); | 80 icu_util::Initialize(); |
80 ResourceBundle::InitSharedInstance("en-US"); | 81 ResourceBundle::InitSharedInstance("en-US"); |
81 | 82 |
82 // Create the message-loop here before creating the desktop. | 83 // Create the message-loop here before creating the desktop. |
83 MessageLoop message_loop(MessageLoop::TYPE_UI); | 84 MessageLoop message_loop(MessageLoop::TYPE_UI); |
| 85 ui::CompositorTestSupport::Initialize(); |
84 | 86 |
85 aura::Desktop::GetInstance(); | 87 aura::Desktop::GetInstance(); |
86 | 88 |
87 // Create a hierarchy of test windows. | 89 // Create a hierarchy of test windows. |
88 DemoWindowDelegate window_delegate1(SK_ColorBLUE); | 90 DemoWindowDelegate window_delegate1(SK_ColorBLUE); |
89 aura::Window window1(&window_delegate1); | 91 aura::Window window1(&window_delegate1); |
90 window1.set_id(1); | 92 window1.set_id(1); |
91 window1.Init(ui::Layer::LAYER_HAS_TEXTURE); | 93 window1.Init(ui::Layer::LAYER_HAS_TEXTURE); |
92 window1.SetBounds(gfx::Rect(100, 100, 400, 400)); | 94 window1.SetBounds(gfx::Rect(100, 100, 400, 400)); |
93 window1.Show(); | 95 window1.Show(); |
94 window1.SetParent(NULL); | 96 window1.SetParent(NULL); |
95 | 97 |
96 DemoWindowDelegate window_delegate2(SK_ColorRED); | 98 DemoWindowDelegate window_delegate2(SK_ColorRED); |
97 aura::Window window2(&window_delegate2); | 99 aura::Window window2(&window_delegate2); |
98 window2.set_id(2); | 100 window2.set_id(2); |
99 window2.Init(ui::Layer::LAYER_HAS_TEXTURE); | 101 window2.Init(ui::Layer::LAYER_HAS_TEXTURE); |
100 window2.SetBounds(gfx::Rect(200, 200, 350, 350)); | 102 window2.SetBounds(gfx::Rect(200, 200, 350, 350)); |
101 window2.Show(); | 103 window2.Show(); |
102 window2.SetParent(NULL); | 104 window2.SetParent(NULL); |
103 | 105 |
104 DemoWindowDelegate window_delegate3(SK_ColorGREEN); | 106 DemoWindowDelegate window_delegate3(SK_ColorGREEN); |
105 aura::Window window3(&window_delegate3); | 107 aura::Window window3(&window_delegate3); |
106 window3.set_id(3); | 108 window3.set_id(3); |
107 window3.Init(ui::Layer::LAYER_HAS_TEXTURE); | 109 window3.Init(ui::Layer::LAYER_HAS_TEXTURE); |
108 window3.SetBounds(gfx::Rect(10, 10, 50, 50)); | 110 window3.SetBounds(gfx::Rect(10, 10, 50, 50)); |
109 window3.Show(); | 111 window3.Show(); |
110 window3.SetParent(&window2); | 112 window3.SetParent(&window2); |
111 | 113 |
112 aura::Desktop::GetInstance()->Run(); | 114 aura::Desktop::GetInstance()->Run(); |
| 115 |
| 116 ui::CompositorTestSupport::Terminate(); |
| 117 |
113 return 0; | 118 return 0; |
114 } | 119 } |
115 | 120 |
OLD | NEW |