OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/interactive_ui/view_event_test_base.h" | 5 #include "chrome/test/interactive_ui/view_event_test_base.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "chrome/browser/automation/ui_controls.h" | 8 #include "chrome/browser/automation/ui_controls.h" |
9 #include "chrome/views/view.h" | 9 #include "chrome/views/view.h" |
10 #include "chrome/views/window.h" | 10 #include "chrome/views/window.h" |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 // View subclass that allows you to specify the preferred size. | 14 // View subclass that allows you to specify the preferred size. |
15 class TestView : public ChromeViews::View { | 15 class TestView : public ChromeViews::View { |
16 public: | 16 public: |
17 TestView() {} | 17 TestView() {} |
18 | 18 |
19 void set_preferred_size(const gfx::Size& size) { preferred_size_ = size; } | 19 void set_preferred_size(const gfx::Size& size) { preferred_size_ = size; } |
20 void GetPreferredSize(CSize* out) { | 20 gfx::Size GetPreferredSize() { |
21 if (!preferred_size_.IsEmpty()) | 21 if (!preferred_size_.IsEmpty()) |
22 *out = preferred_size_.ToSIZE(); | 22 return preferred_size_; |
23 else | 23 return View::GetPreferredSize(); |
24 View::GetPreferredSize(out); | |
25 } | 24 } |
26 | 25 |
27 private: | 26 private: |
28 gfx::Size preferred_size_; | 27 gfx::Size preferred_size_; |
29 | 28 |
30 DISALLOW_COPY_AND_ASSIGN(TestView); | 29 DISALLOW_COPY_AND_ASSIGN(TestView); |
31 }; | 30 }; |
32 | 31 |
33 // Delay in background thread before posting mouse move. | 32 // Delay in background thread before posting mouse move. |
34 const int kMouseMoveDelayMS = 200; | 33 const int kMouseMoveDelayMS = 200; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 108 } |
110 | 109 |
111 void ViewEventTestBase::RunTestMethod(Task* task) { | 110 void ViewEventTestBase::RunTestMethod(Task* task) { |
112 StopBackgroundThread(); | 111 StopBackgroundThread(); |
113 | 112 |
114 scoped_ptr<Task> task_deleter(task); | 113 scoped_ptr<Task> task_deleter(task); |
115 task->Run(); | 114 task->Run(); |
116 if (HasFatalFailure()) | 115 if (HasFatalFailure()) |
117 Done(); | 116 Done(); |
118 } | 117 } |
OLD | NEW |