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 | 5 |
6 #include "chrome/browser/view_ids.h" | 6 #include "chrome/browser/view_ids.h" |
7 #include "chrome/test/automation/browser_proxy.h" | 7 #include "chrome/test/automation/browser_proxy.h" |
8 #include "chrome/test/automation/window_proxy.h" | 8 #include "chrome/test/automation/window_proxy.h" |
9 #include "chrome/test/automation/tab_proxy.h" | 9 #include "chrome/test/automation/tab_proxy.h" |
10 #include "chrome/test/ui/ui_test.h" | 10 #include "chrome/test/ui/ui_test.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 // has been changed). | 31 // has been changed). |
32 bool ActivateTabByClick(AutomationProxy* automation, | 32 bool ActivateTabByClick(AutomationProxy* automation, |
33 WindowProxy* browser_window, | 33 WindowProxy* browser_window, |
34 int tab_index) { | 34 int tab_index) { |
35 // Click on the tab. | 35 // Click on the tab. |
36 gfx::Rect bounds; | 36 gfx::Rect bounds; |
37 | 37 |
38 if (!browser_window->GetViewBounds(VIEW_ID_TAB_0 + tab_index, &bounds, true)) | 38 if (!browser_window->GetViewBounds(VIEW_ID_TAB_0 + tab_index, &bounds, true)) |
39 return false; | 39 return false; |
40 | 40 |
41 POINT click(bounds.CenterPoint().ToPOINT()); | 41 if (!browser_window->SimulateOSClick(bounds.CenterPoint(), |
42 if (!browser_window->SimulateOSClick(click, | |
43 views::Event::EF_LEFT_BUTTON_DOWN)) | 42 views::Event::EF_LEFT_BUTTON_DOWN)) |
44 return false; | 43 return false; |
45 | 44 |
46 // Wait a bit to let the click be processed. | 45 // Wait a bit to let the click be processed. |
47 ::Sleep(kActionDelayMs); | 46 ::Sleep(kActionDelayMs); |
48 | 47 |
49 return true; | 48 return true; |
50 } | 49 } |
51 | 50 |
52 } // namespace | 51 } // namespace |
(...skipping 23 matching lines...) Expand all Loading... |
76 | 75 |
77 // Select tab A. | 76 // Select tab A. |
78 EXPECT_TRUE(ActivateTabByClick(automation(), window.get(), 0)); | 77 EXPECT_TRUE(ActivateTabByClick(automation(), window.get(), 0)); |
79 | 78 |
80 // Close tab B. | 79 // Close tab B. |
81 EXPECT_TRUE(tabB->Close(true)); | 80 EXPECT_TRUE(tabB->Close(true)); |
82 | 81 |
83 // Click on the location bar so that Find box loses focus. | 82 // Click on the location bar so that Find box loses focus. |
84 gfx::Rect bounds; | 83 gfx::Rect bounds; |
85 EXPECT_TRUE(window->GetViewBounds(VIEW_ID_LOCATION_BAR, &bounds, false)); | 84 EXPECT_TRUE(window->GetViewBounds(VIEW_ID_LOCATION_BAR, &bounds, false)); |
86 POINT click(bounds.CenterPoint().ToPOINT()); | 85 EXPECT_TRUE(window->SimulateOSClick(bounds.CenterPoint(), |
87 EXPECT_TRUE(window->SimulateOSClick(click, | |
88 views::Event::EF_LEFT_BUTTON_DOWN)); | 86 views::Event::EF_LEFT_BUTTON_DOWN)); |
89 ::Sleep(kActionDelayMs); | 87 ::Sleep(kActionDelayMs); |
90 int focused_view_id; | 88 int focused_view_id; |
91 EXPECT_TRUE(window->GetFocusedViewID(&focused_view_id)); | 89 EXPECT_TRUE(window->GetFocusedViewID(&focused_view_id)); |
92 EXPECT_EQ(VIEW_ID_LOCATION_BAR, focused_view_id); | 90 EXPECT_EQ(VIEW_ID_LOCATION_BAR, focused_view_id); |
93 | 91 |
94 // This used to crash until bug 1303709 was fixed. | 92 // This used to crash until bug 1303709 was fixed. |
95 EXPECT_TRUE(window->SimulateOSKeyPress(VK_ESCAPE, 0)); | 93 EXPECT_TRUE(window->SimulateOSKeyPress(VK_ESCAPE, 0)); |
96 ::Sleep(kActionDelayMs); | 94 ::Sleep(kActionDelayMs); |
97 } | 95 } |
OLD | NEW |