| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/test/base/view_event_test_base.h" | 5 #include "chrome/test/base/view_event_test_base.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // View subclass that allows you to specify the preferred size. | 35 // View subclass that allows you to specify the preferred size. |
| 36 class TestView : public views::View { | 36 class TestView : public views::View { |
| 37 public: | 37 public: |
| 38 TestView() {} | 38 TestView() {} |
| 39 | 39 |
| 40 void SetPreferredSize(const gfx::Size& size) { | 40 void SetPreferredSize(const gfx::Size& size) { |
| 41 preferred_size_ = size; | 41 preferred_size_ = size; |
| 42 PreferredSizeChanged(); | 42 PreferredSizeChanged(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 gfx::Size GetPreferredSize() { | 45 virtual gfx::Size GetPreferredSize() OVERRIDE { |
| 46 if (!preferred_size_.IsEmpty()) | 46 if (!preferred_size_.IsEmpty()) |
| 47 return preferred_size_; | 47 return preferred_size_; |
| 48 return View::GetPreferredSize(); | 48 return View::GetPreferredSize(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 virtual void Layout() { | 51 virtual void Layout() OVERRIDE { |
| 52 View* child_view = child_at(0); | 52 View* child_view = child_at(0); |
| 53 child_view->SetBounds(0, 0, width(), height()); | 53 child_view->SetBounds(0, 0, width(), height()); |
| 54 } | 54 } |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 gfx::Size preferred_size_; | 57 gfx::Size preferred_size_; |
| 58 | 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(TestView); | 59 DISALLOW_COPY_AND_ASSIGN(TestView); |
| 60 }; | 60 }; |
| 61 | 61 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 dnd_thread_.reset(NULL); | 197 dnd_thread_.reset(NULL); |
| 198 } | 198 } |
| 199 | 199 |
| 200 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { | 200 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { |
| 201 StopBackgroundThread(); | 201 StopBackgroundThread(); |
| 202 | 202 |
| 203 task.Run(); | 203 task.Run(); |
| 204 if (HasFatalFailure()) | 204 if (HasFatalFailure()) |
| 205 Done(); | 205 Done(); |
| 206 } | 206 } |
| OLD | NEW |