Chromium Code Reviews| 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/desktop.h" | 43 #include "ui/aura/desktop.h" |
| 46 #endif | 44 #endif |
| 45 #if !defined(USE_WEBKIT_COMPOSITOR) | |
| 46 #include "ui/gfx/compositor/test/test_compositor.h" | |
|
jonathan.backer
2011/12/07 16:57:20
test_compositor unnecessary include?
| |
| 47 #include "ui/gfx/compositor/test/test_texture.h" | |
| 48 #endif | |
| 47 | 49 |
| 48 using ::testing::_; | 50 using ::testing::_; |
| 49 | 51 |
| 50 namespace { | 52 namespace { |
| 51 | 53 |
| 52 // Returns true if |ancestor| is an ancestor of |layer|. | 54 // Returns true if |ancestor| is an ancestor of |layer|. |
| 53 bool LayerIsAncestor(const ui::Layer* ancestor, const ui::Layer* layer) { | 55 bool LayerIsAncestor(const ui::Layer* ancestor, const ui::Layer* layer) { |
| 54 while (layer && layer != ancestor) | 56 while (layer && layer != ancestor) |
| 55 layer = layer->parent(); | 57 layer = layer->parent(); |
| 56 return layer == ancestor; | 58 return layer == ancestor; |
| (...skipping 2467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2524 #else | 2526 #else |
| 2525 return widget()->GetRootView()->layer(); | 2527 return widget()->GetRootView()->layer(); |
| 2526 #endif | 2528 #endif |
| 2527 } | 2529 } |
| 2528 | 2530 |
| 2529 virtual void SetUp() OVERRIDE { | 2531 virtual void SetUp() OVERRIDE { |
| 2530 ViewTest::SetUp(); | 2532 ViewTest::SetUp(); |
| 2531 old_use_acceleration_ = View::get_use_acceleration_when_possible(); | 2533 old_use_acceleration_ = View::get_use_acceleration_when_possible(); |
| 2532 View::set_use_acceleration_when_possible(true); | 2534 View::set_use_acceleration_when_possible(true); |
| 2533 | 2535 |
| 2536 #if !defined(USE_WEBKIT_COMPOSITOR) | |
| 2534 ui::TestTexture::reset_live_count(); | 2537 ui::TestTexture::reset_live_count(); |
| 2538 #endif | |
| 2535 | 2539 |
| 2536 widget_ = new Widget; | 2540 widget_ = new Widget; |
| 2537 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); | 2541 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); |
| 2538 params.bounds = gfx::Rect(50, 50, 200, 200); | 2542 params.bounds = gfx::Rect(50, 50, 200, 200); |
| 2539 widget_->Init(params); | 2543 widget_->Init(params); |
| 2540 widget_->Show(); | 2544 widget_->Show(); |
| 2541 widget_->GetRootView()->SetBounds(0, 0, 200, 200); | 2545 widget_->GetRootView()->SetBounds(0, 0, 200, 200); |
| 2542 } | 2546 } |
| 2543 | 2547 |
| 2544 virtual void TearDown() OVERRIDE { | 2548 virtual void TearDown() OVERRIDE { |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3059 ScrambleTree(content); | 3063 ScrambleTree(content); |
| 3060 EXPECT_TRUE(ViewAndLayerTreeAreConsistent(content, content->layer())); | 3064 EXPECT_TRUE(ViewAndLayerTreeAreConsistent(content, content->layer())); |
| 3061 | 3065 |
| 3062 ScrambleTree(content); | 3066 ScrambleTree(content); |
| 3063 EXPECT_TRUE(ViewAndLayerTreeAreConsistent(content, content->layer())); | 3067 EXPECT_TRUE(ViewAndLayerTreeAreConsistent(content, content->layer())); |
| 3064 } | 3068 } |
| 3065 | 3069 |
| 3066 #endif // VIEWS_COMPOSITOR | 3070 #endif // VIEWS_COMPOSITOR |
| 3067 | 3071 |
| 3068 } // namespace views | 3072 } // namespace views |
| OLD | NEW |