| 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/location.h" | 8 #include "base/location.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // View subclass that allows you to specify the preferred size. | 24 // View subclass that allows you to specify the preferred size. |
| 25 class TestView : public views::View { | 25 class TestView : public views::View { |
| 26 public: | 26 public: |
| 27 explicit TestView(ViewEventTestBase* harness) : harness_(harness) {} | 27 explicit TestView(ViewEventTestBase* harness) : harness_(harness) {} |
| 28 | 28 |
| 29 gfx::Size GetPreferredSize() const override { | 29 gfx::Size GetPreferredSize() const override { |
| 30 return harness_->GetPreferredSize(); | 30 return harness_->GetPreferredSize(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void Layout() override { | 33 void Layout() override { |
| 34 // Permit a test to remove the view being tested from the hierarchy, then |
| 35 // still handle a _NET_WM_STATE event on Linux during teardown that triggers |
| 36 // layout. |
| 37 if (!has_children()) |
| 38 return; |
| 39 |
| 34 View* child_view = child_at(0); | 40 View* child_view = child_at(0); |
| 35 child_view->SetBounds(0, 0, width(), height()); | 41 child_view->SetBounds(0, 0, width(), height()); |
| 36 } | 42 } |
| 37 | 43 |
| 38 private: | 44 private: |
| 39 ViewEventTestBase* harness_; | 45 ViewEventTestBase* harness_; |
| 40 | 46 |
| 41 DISALLOW_COPY_AND_ASSIGN(TestView); | 47 DISALLOW_COPY_AND_ASSIGN(TestView); |
| 42 }; | 48 }; |
| 43 | 49 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 dnd_thread_.reset(NULL); | 161 dnd_thread_.reset(NULL); |
| 156 } | 162 } |
| 157 | 163 |
| 158 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { | 164 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { |
| 159 StopBackgroundThread(); | 165 StopBackgroundThread(); |
| 160 | 166 |
| 161 task.Run(); | 167 task.Run(); |
| 162 if (HasFatalFailure()) | 168 if (HasFatalFailure()) |
| 163 Done(); | 169 Done(); |
| 164 } | 170 } |
| OLD | NEW |