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 <map> | 5 #include <map> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
12 #include "ui/base/accelerators/accelerator.h" | 12 #include "ui/base/accelerators/accelerator.h" |
13 #include "ui/base/clipboard/clipboard.h" | 13 #include "ui/base/clipboard/clipboard.h" |
14 #include "ui/base/keycodes/keyboard_codes.h" | 14 #include "ui/base/keycodes/keyboard_codes.h" |
15 #include "ui/base/models/simple_menu_model.h" | 15 #include "ui/base/models/simple_menu_model.h" |
16 #include "ui/gfx/canvas_skia.h" | 16 #include "ui/gfx/canvas_skia.h" |
17 #include "ui/gfx/compositor/compositor.h" | 17 #include "ui/gfx/compositor/compositor.h" |
18 #include "ui/gfx/compositor/layer.h" | 18 #include "ui/gfx/compositor/layer.h" |
19 #include "ui/gfx/compositor/layer_animator.h" | 19 #include "ui/gfx/compositor/layer_animator.h" |
20 #include "ui/gfx/compositor/test/test_compositor.h" | |
21 #include "ui/gfx/compositor/test/test_texture.h" | |
22 #include "ui/gfx/path.h" | 20 #include "ui/gfx/path.h" |
23 #include "ui/gfx/transform.h" | 21 #include "ui/gfx/transform.h" |
24 #include "ui/views/background.h" | 22 #include "ui/views/background.h" |
25 #include "ui/views/controls/button/button_dropdown.h" | 23 #include "ui/views/controls/button/button_dropdown.h" |
26 #include "ui/views/controls/button/checkbox.h" | 24 #include "ui/views/controls/button/checkbox.h" |
27 #include "ui/views/controls/native/native_view_host.h" | 25 #include "ui/views/controls/native/native_view_host.h" |
28 #include "ui/views/controls/scroll_view.h" | 26 #include "ui/views/controls/scroll_view.h" |
29 #include "ui/views/controls/textfield/textfield.h" | 27 #include "ui/views/controls/textfield/textfield.h" |
30 #include "ui/views/events/event.h" | 28 #include "ui/views/events/event.h" |
31 #include "ui/views/focus/accelerator_handler.h" | 29 #include "ui/views/focus/accelerator_handler.h" |
32 #include "ui/views/focus/view_storage.h" | 30 #include "ui/views/focus/view_storage.h" |
33 #include "ui/views/test/views_test_base.h" | 31 #include "ui/views/test/views_test_base.h" |
34 #include "ui/views/touchui/gesture_manager.h" | 32 #include "ui/views/touchui/gesture_manager.h" |
35 #include "ui/views/view.h" | 33 #include "ui/views/view.h" |
36 #include "ui/views/views_delegate.h" | 34 #include "ui/views/views_delegate.h" |
37 #include "ui/views/widget/native_widget.h" | 35 #include "ui/views/widget/native_widget.h" |
38 #include "ui/views/widget/root_view.h" | 36 #include "ui/views/widget/root_view.h" |
39 #include "ui/views/window/dialog_delegate.h" | 37 #include "ui/views/window/dialog_delegate.h" |
40 | 38 |
41 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
42 #include "ui/views/test/test_views_delegate.h" | 40 #include "ui/views/test/test_views_delegate.h" |
43 #endif | 41 #endif |
44 #if defined(USE_AURA) | 42 #if defined(USE_AURA) |
45 #include "ui/aura/root_window.h" | 43 #include "ui/aura/root_window.h" |
46 #endif | 44 #endif |
| 45 #if !defined(USE_WEBKIT_COMPOSITOR) |
| 46 #include "ui/gfx/compositor/test/test_texture.h" |
| 47 #endif |
47 | 48 |
48 using ::testing::_; | 49 using ::testing::_; |
49 | 50 |
50 namespace { | 51 namespace { |
51 | 52 |
52 // Returns true if |ancestor| is an ancestor of |layer|. | 53 // Returns true if |ancestor| is an ancestor of |layer|. |
53 bool LayerIsAncestor(const ui::Layer* ancestor, const ui::Layer* layer) { | 54 bool LayerIsAncestor(const ui::Layer* ancestor, const ui::Layer* layer) { |
54 while (layer && layer != ancestor) | 55 while (layer && layer != ancestor) |
55 layer = layer->parent(); | 56 layer = layer->parent(); |
56 return layer == ancestor; | 57 return layer == ancestor; |
(...skipping 2467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2524 #else | 2525 #else |
2525 return widget()->GetRootView()->layer(); | 2526 return widget()->GetRootView()->layer(); |
2526 #endif | 2527 #endif |
2527 } | 2528 } |
2528 | 2529 |
2529 virtual void SetUp() OVERRIDE { | 2530 virtual void SetUp() OVERRIDE { |
2530 ViewTest::SetUp(); | 2531 ViewTest::SetUp(); |
2531 old_use_acceleration_ = View::get_use_acceleration_when_possible(); | 2532 old_use_acceleration_ = View::get_use_acceleration_when_possible(); |
2532 View::set_use_acceleration_when_possible(true); | 2533 View::set_use_acceleration_when_possible(true); |
2533 | 2534 |
| 2535 #if !defined(USE_WEBKIT_COMPOSITOR) |
2534 ui::TestTexture::reset_live_count(); | 2536 ui::TestTexture::reset_live_count(); |
| 2537 #endif |
2535 | 2538 |
2536 widget_ = new Widget; | 2539 widget_ = new Widget; |
2537 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); | 2540 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); |
2538 params.bounds = gfx::Rect(50, 50, 200, 200); | 2541 params.bounds = gfx::Rect(50, 50, 200, 200); |
2539 widget_->Init(params); | 2542 widget_->Init(params); |
2540 widget_->Show(); | 2543 widget_->Show(); |
2541 widget_->GetRootView()->SetBounds(0, 0, 200, 200); | 2544 widget_->GetRootView()->SetBounds(0, 0, 200, 200); |
2542 } | 2545 } |
2543 | 2546 |
2544 virtual void TearDown() OVERRIDE { | 2547 virtual void TearDown() OVERRIDE { |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3070 ScrambleTree(content); | 3073 ScrambleTree(content); |
3071 EXPECT_TRUE(ViewAndLayerTreeAreConsistent(content, content->layer())); | 3074 EXPECT_TRUE(ViewAndLayerTreeAreConsistent(content, content->layer())); |
3072 | 3075 |
3073 ScrambleTree(content); | 3076 ScrambleTree(content); |
3074 EXPECT_TRUE(ViewAndLayerTreeAreConsistent(content, content->layer())); | 3077 EXPECT_TRUE(ViewAndLayerTreeAreConsistent(content, content->layer())); |
3075 } | 3078 } |
3076 | 3079 |
3077 #endif // VIEWS_COMPOSITOR | 3080 #endif // VIEWS_COMPOSITOR |
3078 | 3081 |
3079 } // namespace views | 3082 } // namespace views |
OLD | NEW |