| 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/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 | 1154 |
| 1155 DefaultButtonTest() | 1155 DefaultButtonTest() |
| 1156 : focus_manager_(NULL), | 1156 : focus_manager_(NULL), |
| 1157 test_dialog_(NULL), | 1157 test_dialog_(NULL), |
| 1158 client_view_(NULL), | 1158 client_view_(NULL), |
| 1159 ok_button_(NULL), | 1159 ok_button_(NULL), |
| 1160 cancel_button_(NULL) { | 1160 cancel_button_(NULL) { |
| 1161 } | 1161 } |
| 1162 | 1162 |
| 1163 virtual void SetUp() OVERRIDE { | 1163 virtual void SetUp() OVERRIDE { |
| 1164 ViewTest::SetUp(); |
| 1164 test_dialog_ = new TestDialog(NULL); | 1165 test_dialog_ = new TestDialog(NULL); |
| 1165 Widget* window = | 1166 Widget* window = |
| 1166 Widget::CreateWindowWithBounds(test_dialog_, gfx::Rect(0, 0, 100, 100)); | 1167 Widget::CreateWindowWithBounds(test_dialog_, gfx::Rect(0, 0, 100, 100)); |
| 1167 test_dialog_->widget_ = window; | 1168 test_dialog_->widget_ = window; |
| 1168 window->Show(); | 1169 window->Show(); |
| 1169 focus_manager_ = test_dialog_->contents_->GetFocusManager(); | 1170 focus_manager_ = test_dialog_->contents_->GetFocusManager(); |
| 1170 ASSERT_TRUE(focus_manager_ != NULL); | 1171 ASSERT_TRUE(focus_manager_ != NULL); |
| 1171 client_view_ = | 1172 client_view_ = |
| 1172 static_cast<DialogClientView*>(window->client_view()); | 1173 static_cast<DialogClientView*>(window->client_view()); |
| 1173 ok_button_ = client_view_->ok_button(); | 1174 ok_button_ = client_view_->ok_button(); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 } | 1265 } |
| 1265 | 1266 |
| 1266 class ButtonDropDownTest : public ViewTest { | 1267 class ButtonDropDownTest : public ViewTest { |
| 1267 public: | 1268 public: |
| 1268 ButtonDropDownTest() | 1269 ButtonDropDownTest() |
| 1269 : test_dialog_(NULL), | 1270 : test_dialog_(NULL), |
| 1270 button_as_view_(NULL) { | 1271 button_as_view_(NULL) { |
| 1271 } | 1272 } |
| 1272 | 1273 |
| 1273 virtual void SetUp() OVERRIDE { | 1274 virtual void SetUp() OVERRIDE { |
| 1275 ViewTest::SetUp(); |
| 1274 test_dialog_ = new TestDialog(&mock_menu_model_); | 1276 test_dialog_ = new TestDialog(&mock_menu_model_); |
| 1275 Widget* window = | 1277 Widget* window = |
| 1276 Widget::CreateWindowWithBounds(test_dialog_, gfx::Rect(0, 0, 100, 100)); | 1278 Widget::CreateWindowWithBounds(test_dialog_, gfx::Rect(0, 0, 100, 100)); |
| 1277 test_dialog_->widget_ = window; | 1279 test_dialog_->widget_ = window; |
| 1278 window->Show(); | 1280 window->Show(); |
| 1279 test_dialog_->button_drop_->SetBounds(0, 0, 100, 100); | 1281 test_dialog_->button_drop_->SetBounds(0, 0, 100, 100); |
| 1280 // We have to cast the button back into a View in order to invoke it's | 1282 // We have to cast the button back into a View in order to invoke it's |
| 1281 // OnMouseReleased method. | 1283 // OnMouseReleased method. |
| 1282 button_as_view_ = static_cast<View*>(test_dialog_->button_drop_); | 1284 button_as_view_ = static_cast<View*>(test_dialog_->button_drop_); |
| 1283 } | 1285 } |
| (...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2410 } // namespace | 2412 } // namespace |
| 2411 | 2413 |
| 2412 class ViewLayerTest : public ViewsTestBase { | 2414 class ViewLayerTest : public ViewsTestBase { |
| 2413 public: | 2415 public: |
| 2414 ViewLayerTest() : widget_(NULL), old_use_acceleration_(false) {} | 2416 ViewLayerTest() : widget_(NULL), old_use_acceleration_(false) {} |
| 2415 | 2417 |
| 2416 virtual ~ViewLayerTest() { | 2418 virtual ~ViewLayerTest() { |
| 2417 } | 2419 } |
| 2418 | 2420 |
| 2419 virtual void SetUp() OVERRIDE { | 2421 virtual void SetUp() OVERRIDE { |
| 2422 ViewTest::SetUp(); |
| 2420 old_use_acceleration_ = View::get_use_acceleration_when_possible(); | 2423 old_use_acceleration_ = View::get_use_acceleration_when_possible(); |
| 2421 View::set_use_acceleration_when_possible(true); | 2424 View::set_use_acceleration_when_possible(true); |
| 2422 | 2425 |
| 2423 TestTexture::reset_live_count(); | 2426 TestTexture::reset_live_count(); |
| 2424 | 2427 |
| 2425 Widget::set_compositor_factory_for_testing(&TestCreateCompositor); | 2428 Widget::set_compositor_factory_for_testing(&TestCreateCompositor); |
| 2426 widget_ = new Widget; | 2429 widget_ = new Widget; |
| 2427 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); | 2430 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); |
| 2428 params.bounds = gfx::Rect(50, 50, 200, 200); | 2431 params.bounds = gfx::Rect(50, 50, 200, 200); |
| 2429 widget_->Init(params); | 2432 widget_->Init(params); |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2797 EXPECT_EQ(gfx::Rect(11, 22, 100, 200), widget_view_host->layer()->bounds()); | 2800 EXPECT_EQ(gfx::Rect(11, 22, 100, 200), widget_view_host->layer()->bounds()); |
| 2798 ASSERT_TRUE(child_view->layer() != NULL); | 2801 ASSERT_TRUE(child_view->layer() != NULL); |
| 2799 EXPECT_EQ(gfx::Rect(5, 6, 10, 11), child_view->layer()->bounds()); | 2802 EXPECT_EQ(gfx::Rect(5, 6, 10, 11), child_view->layer()->bounds()); |
| 2800 | 2803 |
| 2801 child_widget->CloseNow(); | 2804 child_widget->CloseNow(); |
| 2802 } | 2805 } |
| 2803 | 2806 |
| 2804 #endif // VIEWS_COMPOSITOR | 2807 #endif // VIEWS_COMPOSITOR |
| 2805 | 2808 |
| 2806 } // namespace views | 2809 } // namespace views |
| OLD | NEW |