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/views/view.h" | 7 #include "chrome/views/view.h" |
8 #include "chrome/test/automation/browser_proxy.h" | 8 #include "chrome/test/automation/browser_proxy.h" |
9 #include "chrome/test/automation/window_proxy.h" | 9 #include "chrome/test/automation/window_proxy.h" |
10 #include "chrome/test/automation/tab_proxy.h" | 10 #include "chrome/test/automation/tab_proxy.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 // Wait a bit to let the click be processed. | 46 // Wait a bit to let the click be processed. |
47 ::Sleep(kActionDelayMs); | 47 ::Sleep(kActionDelayMs); |
48 | 48 |
49 return true; | 49 return true; |
50 } | 50 } |
51 | 51 |
52 } // namespace | 52 } // namespace |
53 | 53 |
54 TEST_F(FindInPageTest, CrashEscHandlers) { | 54 TEST_F(FindInPageTest, CrashEscHandlers) { |
55 scoped_refptr<HTTPTestServer> server = | 55 TestServer server(kDocRoot); |
56 HTTPTestServer::CreateServer(kDocRoot); | |
57 ASSERT_TRUE(NULL != server.get()); | |
58 | 56 |
59 scoped_ptr<BrowserProxy> browser(automation()->GetLastActiveBrowserWindow()); | 57 scoped_ptr<BrowserProxy> browser(automation()->GetLastActiveBrowserWindow()); |
60 ASSERT_TRUE(browser.get() != NULL); | 58 ASSERT_TRUE(browser.get() != NULL); |
61 scoped_ptr<WindowProxy> window( | 59 scoped_ptr<WindowProxy> window( |
62 automation()->GetWindowForBrowser(browser.get())); | 60 automation()->GetWindowForBrowser(browser.get())); |
63 ASSERT_TRUE(window.get() != NULL); | 61 ASSERT_TRUE(window.get() != NULL); |
64 | 62 |
65 // First we navigate to our test page (tab A). | 63 // First we navigate to our test page (tab A). |
66 GURL url = server->TestServerPageW(kSimplePage); | 64 GURL url = server.TestServerPageW(kSimplePage); |
67 scoped_ptr<TabProxy> tabA(GetActiveTab()); | 65 scoped_ptr<TabProxy> tabA(GetActiveTab()); |
68 EXPECT_NE(AUTOMATION_MSG_NAVIGATION_ERROR, tabA->NavigateToURL(url)); | 66 EXPECT_NE(AUTOMATION_MSG_NAVIGATION_ERROR, tabA->NavigateToURL(url)); |
69 | 67 |
70 EXPECT_TRUE(tabA->OpenFindInPage()); | 68 EXPECT_TRUE(tabA->OpenFindInPage()); |
71 | 69 |
72 // Open another tab (tab B). | 70 // Open another tab (tab B). |
73 EXPECT_TRUE(browser->AppendTab(url)); | 71 EXPECT_TRUE(browser->AppendTab(url)); |
74 scoped_ptr<TabProxy> tabB(GetActiveTab()); | 72 scoped_ptr<TabProxy> tabB(GetActiveTab()); |
75 | 73 |
76 EXPECT_TRUE(tabB->OpenFindInPage()); | 74 EXPECT_TRUE(tabB->OpenFindInPage()); |
(...skipping 12 matching lines...) Expand all Loading... |
89 views::Event::EF_LEFT_BUTTON_DOWN)); | 87 views::Event::EF_LEFT_BUTTON_DOWN)); |
90 ::Sleep(kActionDelayMs); | 88 ::Sleep(kActionDelayMs); |
91 int focused_view_id; | 89 int focused_view_id; |
92 EXPECT_TRUE(window->GetFocusedViewID(&focused_view_id)); | 90 EXPECT_TRUE(window->GetFocusedViewID(&focused_view_id)); |
93 EXPECT_EQ(VIEW_ID_LOCATION_BAR, focused_view_id); | 91 EXPECT_EQ(VIEW_ID_LOCATION_BAR, focused_view_id); |
94 | 92 |
95 // This used to crash until bug 1303709 was fixed. | 93 // This used to crash until bug 1303709 was fixed. |
96 EXPECT_TRUE(window->SimulateOSKeyPress(VK_ESCAPE, 0)); | 94 EXPECT_TRUE(window->SimulateOSKeyPress(VK_ESCAPE, 0)); |
97 ::Sleep(kActionDelayMs); | 95 ::Sleep(kActionDelayMs); |
98 } | 96 } |
OLD | NEW |