Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Side by Side Diff: ui/views/view_unittest.cc

Issue 8873001: Revert 113470 - Makes tests either use mock compositor or mock WebGraphicsContext3D depending upo... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/run_all_unittests.cc ('k') | ui/views/views.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
20 #include "ui/gfx/path.h" 22 #include "ui/gfx/path.h"
21 #include "ui/gfx/transform.h" 23 #include "ui/gfx/transform.h"
22 #include "ui/views/background.h" 24 #include "ui/views/background.h"
23 #include "ui/views/controls/button/button_dropdown.h" 25 #include "ui/views/controls/button/button_dropdown.h"
24 #include "ui/views/controls/button/checkbox.h" 26 #include "ui/views/controls/button/checkbox.h"
25 #include "ui/views/controls/native/native_view_host.h" 27 #include "ui/views/controls/native/native_view_host.h"
26 #include "ui/views/controls/scroll_view.h" 28 #include "ui/views/controls/scroll_view.h"
27 #include "ui/views/controls/textfield/textfield.h" 29 #include "ui/views/controls/textfield/textfield.h"
28 #include "ui/views/events/event.h" 30 #include "ui/views/events/event.h"
29 #include "ui/views/focus/accelerator_handler.h" 31 #include "ui/views/focus/accelerator_handler.h"
30 #include "ui/views/focus/view_storage.h" 32 #include "ui/views/focus/view_storage.h"
31 #include "ui/views/test/views_test_base.h" 33 #include "ui/views/test/views_test_base.h"
32 #include "ui/views/touchui/gesture_manager.h" 34 #include "ui/views/touchui/gesture_manager.h"
33 #include "ui/views/view.h" 35 #include "ui/views/view.h"
34 #include "ui/views/views_delegate.h" 36 #include "ui/views/views_delegate.h"
35 #include "ui/views/widget/native_widget.h" 37 #include "ui/views/widget/native_widget.h"
36 #include "ui/views/widget/root_view.h" 38 #include "ui/views/widget/root_view.h"
37 #include "ui/views/window/dialog_delegate.h" 39 #include "ui/views/window/dialog_delegate.h"
38 40
39 #if defined(OS_WIN) 41 #if defined(OS_WIN)
40 #include "ui/views/test/test_views_delegate.h" 42 #include "ui/views/test/test_views_delegate.h"
41 #endif 43 #endif
42 #if defined(USE_AURA) 44 #if defined(USE_AURA)
43 #include "ui/aura/root_window.h" 45 #include "ui/aura/root_window.h"
44 #endif 46 #endif
45 #if !defined(USE_WEBKIT_COMPOSITOR)
46 #include "ui/gfx/compositor/test/test_texture.h"
47 #endif
48 47
49 using ::testing::_; 48 using ::testing::_;
50 49
51 namespace { 50 namespace {
52 51
53 // Returns true if |ancestor| is an ancestor of |layer|. 52 // Returns true if |ancestor| is an ancestor of |layer|.
54 bool LayerIsAncestor(const ui::Layer* ancestor, const ui::Layer* layer) { 53 bool LayerIsAncestor(const ui::Layer* ancestor, const ui::Layer* layer) {
55 while (layer && layer != ancestor) 54 while (layer && layer != ancestor)
56 layer = layer->parent(); 55 layer = layer->parent();
57 return layer == ancestor; 56 return layer == ancestor;
(...skipping 2467 matching lines...) Expand 10 before | Expand all | Expand 10 after
2525 #else 2524 #else
2526 return widget()->GetRootView()->layer(); 2525 return widget()->GetRootView()->layer();
2527 #endif 2526 #endif
2528 } 2527 }
2529 2528
2530 virtual void SetUp() OVERRIDE { 2529 virtual void SetUp() OVERRIDE {
2531 ViewTest::SetUp(); 2530 ViewTest::SetUp();
2532 old_use_acceleration_ = View::get_use_acceleration_when_possible(); 2531 old_use_acceleration_ = View::get_use_acceleration_when_possible();
2533 View::set_use_acceleration_when_possible(true); 2532 View::set_use_acceleration_when_possible(true);
2534 2533
2535 #if !defined(USE_WEBKIT_COMPOSITOR)
2536 ui::TestTexture::reset_live_count(); 2534 ui::TestTexture::reset_live_count();
2537 #endif
2538 2535
2539 widget_ = new Widget; 2536 widget_ = new Widget;
2540 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); 2537 Widget::InitParams params(Widget::InitParams::TYPE_POPUP);
2541 params.bounds = gfx::Rect(50, 50, 200, 200); 2538 params.bounds = gfx::Rect(50, 50, 200, 200);
2542 widget_->Init(params); 2539 widget_->Init(params);
2543 widget_->Show(); 2540 widget_->Show();
2544 widget_->GetRootView()->SetBounds(0, 0, 200, 200); 2541 widget_->GetRootView()->SetBounds(0, 0, 200, 200);
2545 } 2542 }
2546 2543
2547 virtual void TearDown() OVERRIDE { 2544 virtual void TearDown() OVERRIDE {
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
3073 ScrambleTree(content); 3070 ScrambleTree(content);
3074 EXPECT_TRUE(ViewAndLayerTreeAreConsistent(content, content->layer())); 3071 EXPECT_TRUE(ViewAndLayerTreeAreConsistent(content, content->layer()));
3075 3072
3076 ScrambleTree(content); 3073 ScrambleTree(content);
3077 EXPECT_TRUE(ViewAndLayerTreeAreConsistent(content, content->layer())); 3074 EXPECT_TRUE(ViewAndLayerTreeAreConsistent(content, content->layer()));
3078 } 3075 }
3079 3076
3080 #endif // VIEWS_COMPOSITOR 3077 #endif // VIEWS_COMPOSITOR
3081 3078
3082 } // namespace views 3079 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/run_all_unittests.cc ('k') | ui/views/views.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698