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/app/chrome_dll_resource.h" | 5 #include "chrome/app/chrome_dll_resource.h" |
6 #include "chrome/browser/find_in_page_controller.h" | 6 #include "chrome/browser/find_in_page_controller.h" |
7 #include "chrome/test/automation/browser_proxy.h" | 7 #include "chrome/test/automation/browser_proxy.h" |
8 #include "chrome/test/automation/tab_proxy.h" | 8 #include "chrome/test/automation/tab_proxy.h" |
9 #include "chrome/test/automation/window_proxy.h" | 9 #include "chrome/test/automation/window_proxy.h" |
10 #include "chrome/test/ui/ui_test.h" | 10 #include "chrome/test/ui/ui_test.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 scoped_ptr<TabProxy> tab(GetActiveTab()); | 115 scoped_ptr<TabProxy> tab(GetActiveTab()); |
116 ASSERT_TRUE(tab->NavigateToURL(url)); | 116 ASSERT_TRUE(tab->NavigateToURL(url)); |
117 | 117 |
118 // This string appears 5 times at the bottom of a long page. If Find restarts | 118 // This string appears 5 times at the bottom of a long page. If Find restarts |
119 // properly after a timeout, it will find 5 matches, not just 1. | 119 // properly after a timeout, it will find 5 matches, not just 1. |
120 EXPECT_EQ(5, tab->FindInPage(L"008.xml", FWD, IGNORE_CASE, false)); | 120 EXPECT_EQ(5, tab->FindInPage(L"008.xml", FWD, IGNORE_CASE, false)); |
121 } | 121 } |
122 | 122 |
123 // The find window should not change its location just because we open and close | 123 // The find window should not change its location just because we open and close |
124 // a new tab. | 124 // a new tab. |
125 TEST_F(FindInPageControllerTest, DISABLED_FindMovesOnTabClose_Issue1343052) { | 125 TEST_F(FindInPageControllerTest, FindMovesOnTabClose_Issue1343052) { |
126 TestServer server(L"chrome/test/data"); | 126 TestServer server(L"chrome/test/data"); |
127 | 127 |
128 GURL url = server.TestServerPageW(kFramePage); | 128 GURL url = server.TestServerPageW(kFramePage); |
129 scoped_ptr<TabProxy> tabA(GetActiveTab()); | 129 scoped_ptr<TabProxy> tabA(GetActiveTab()); |
130 ASSERT_TRUE(tabA->NavigateToURL(url)); | 130 ASSERT_TRUE(tabA->NavigateToURL(url)); |
131 | 131 |
132 scoped_ptr<BrowserProxy> browser(automation()->GetLastActiveBrowserWindow()); | 132 scoped_ptr<BrowserProxy> browser(automation()->GetLastActiveBrowserWindow()); |
133 ASSERT_TRUE(browser.get() != NULL); | 133 ASSERT_TRUE(browser.get() != NULL); |
134 | 134 |
135 // Toggle the bookmark bar state. | 135 // Toggle the bookmark bar state. |
136 browser->ApplyAccelerator(IDC_SHOW_BOOKMARKS_BAR); | 136 browser->ApplyAccelerator(IDC_SHOW_BOOKMARKS_BAR); |
| 137 EXPECT_TRUE(WaitForBookmarkBarVisibilityChange(browser.get(), true)); |
137 | 138 |
138 // Open the Find window and wait for it to animate. | 139 // Open the Find window and wait for it to animate. |
139 EXPECT_TRUE(tabA->OpenFindInPage()); | 140 EXPECT_TRUE(tabA->OpenFindInPage()); |
140 EXPECT_TRUE(WaitForFindWindowFullyVisible(tabA.get())); | 141 EXPECT_TRUE(WaitForFindWindowFullyVisible(tabA.get())); |
141 | 142 |
142 // Find its location. | 143 // Find its location. |
143 int x = -1, y = -1; | 144 int x = -1, y = -1; |
144 EXPECT_TRUE(tabA->GetFindWindowLocation(&x, &y)); | 145 EXPECT_TRUE(tabA->GetFindWindowLocation(&x, &y)); |
145 | 146 |
146 // Open another tab (tab B). | 147 // Open another tab (tab B). |
147 EXPECT_TRUE(browser->AppendTab(url)); | 148 EXPECT_TRUE(browser->AppendTab(url)); |
148 scoped_ptr<TabProxy> tabB(GetActiveTab()); | 149 scoped_ptr<TabProxy> tabB(GetActiveTab()); |
149 | 150 |
150 // Close tab B. | 151 // Close tab B. |
151 EXPECT_TRUE(tabB->Close(true)); | 152 EXPECT_TRUE(tabB->Close(true)); |
152 | 153 |
153 // See if the Find window has moved. | 154 // See if the Find window has moved. |
154 int new_x = -1, new_y = -1; | 155 int new_x = -1, new_y = -1; |
155 EXPECT_TRUE(tabA->GetFindWindowLocation(&new_x, &new_y)); | 156 EXPECT_TRUE(tabA->GetFindWindowLocation(&new_x, &new_y)); |
156 | 157 |
157 EXPECT_EQ(x, new_x); | 158 EXPECT_EQ(x, new_x); |
158 EXPECT_EQ(y, new_y); | 159 EXPECT_EQ(y, new_y); |
159 | 160 |
160 // Now reset the bookmarks bar state and try the same again. | 161 // Now reset the bookmarks bar state and try the same again. |
161 browser->ApplyAccelerator(IDC_SHOW_BOOKMARKS_BAR); | 162 browser->ApplyAccelerator(IDC_SHOW_BOOKMARKS_BAR); |
162 Sleep(kWaitForActionMsec); | 163 EXPECT_TRUE(WaitForBookmarkBarVisibilityChange(browser.get(), false)); |
163 | 164 |
164 // Bookmark bar has moved, reset our coordinates. | 165 // Bookmark bar has moved, reset our coordinates. |
165 EXPECT_TRUE(tabA->GetFindWindowLocation(&x, &y)); | 166 EXPECT_TRUE(tabA->GetFindWindowLocation(&x, &y)); |
166 | 167 |
167 // Open another tab (tab C). | 168 // Open another tab (tab C). |
168 EXPECT_TRUE(browser->AppendTab(url)); | 169 EXPECT_TRUE(browser->AppendTab(url)); |
169 scoped_ptr<TabProxy> tabC(GetActiveTab()); | 170 scoped_ptr<TabProxy> tabC(GetActiveTab()); |
170 | 171 |
171 // Close it. | 172 // Close it. |
172 EXPECT_TRUE(tabC->Close(true)); | 173 EXPECT_TRUE(tabC->Close(true)); |
173 | 174 |
174 // See if the Find window has moved. | 175 // See if the Find window has moved. |
175 EXPECT_TRUE(tabA->GetFindWindowLocation(&new_x, &new_y)); | 176 EXPECT_TRUE(tabA->GetFindWindowLocation(&new_x, &new_y)); |
176 | 177 |
177 EXPECT_EQ(x, new_x); | 178 EXPECT_EQ(x, new_x); |
178 EXPECT_EQ(y, new_y); | 179 EXPECT_EQ(y, new_y); |
179 } | 180 } |
OLD | NEW |