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 TestServer server(kDocRoot); | 55 scoped_refptr<HTTPTestServer> server = |
| 56 HTTPTestServer::CreateServer(kDocRoot); |
| 57 ASSERT_TRUE(NULL != server.get()); |
56 | 58 |
57 scoped_ptr<BrowserProxy> browser(automation()->GetLastActiveBrowserWindow()); | 59 scoped_ptr<BrowserProxy> browser(automation()->GetLastActiveBrowserWindow()); |
58 ASSERT_TRUE(browser.get() != NULL); | 60 ASSERT_TRUE(browser.get() != NULL); |
59 scoped_ptr<WindowProxy> window( | 61 scoped_ptr<WindowProxy> window( |
60 automation()->GetWindowForBrowser(browser.get())); | 62 automation()->GetWindowForBrowser(browser.get())); |
61 ASSERT_TRUE(window.get() != NULL); | 63 ASSERT_TRUE(window.get() != NULL); |
62 | 64 |
63 // First we navigate to our test page (tab A). | 65 // First we navigate to our test page (tab A). |
64 GURL url = server.TestServerPageW(kSimplePage); | 66 GURL url = server->TestServerPageW(kSimplePage); |
65 scoped_ptr<TabProxy> tabA(GetActiveTab()); | 67 scoped_ptr<TabProxy> tabA(GetActiveTab()); |
66 EXPECT_NE(AUTOMATION_MSG_NAVIGATION_ERROR, tabA->NavigateToURL(url)); | 68 EXPECT_NE(AUTOMATION_MSG_NAVIGATION_ERROR, tabA->NavigateToURL(url)); |
67 | 69 |
68 EXPECT_TRUE(tabA->OpenFindInPage()); | 70 EXPECT_TRUE(tabA->OpenFindInPage()); |
69 | 71 |
70 // Open another tab (tab B). | 72 // Open another tab (tab B). |
71 EXPECT_TRUE(browser->AppendTab(url)); | 73 EXPECT_TRUE(browser->AppendTab(url)); |
72 scoped_ptr<TabProxy> tabB(GetActiveTab()); | 74 scoped_ptr<TabProxy> tabB(GetActiveTab()); |
73 | 75 |
74 EXPECT_TRUE(tabB->OpenFindInPage()); | 76 EXPECT_TRUE(tabB->OpenFindInPage()); |
(...skipping 12 matching lines...) Expand all Loading... |
87 views::Event::EF_LEFT_BUTTON_DOWN)); | 89 views::Event::EF_LEFT_BUTTON_DOWN)); |
88 ::Sleep(kActionDelayMs); | 90 ::Sleep(kActionDelayMs); |
89 int focused_view_id; | 91 int focused_view_id; |
90 EXPECT_TRUE(window->GetFocusedViewID(&focused_view_id)); | 92 EXPECT_TRUE(window->GetFocusedViewID(&focused_view_id)); |
91 EXPECT_EQ(VIEW_ID_LOCATION_BAR, focused_view_id); | 93 EXPECT_EQ(VIEW_ID_LOCATION_BAR, focused_view_id); |
92 | 94 |
93 // This used to crash until bug 1303709 was fixed. | 95 // This used to crash until bug 1303709 was fixed. |
94 EXPECT_TRUE(window->SimulateOSKeyPress(VK_ESCAPE, 0)); | 96 EXPECT_TRUE(window->SimulateOSKeyPress(VK_ESCAPE, 0)); |
95 ::Sleep(kActionDelayMs); | 97 ::Sleep(kActionDelayMs); |
96 } | 98 } |
OLD | NEW |