Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(344)

Side by Side Diff: chrome/browser/views/find_bar_win_browsertest.cc

Issue 101013: Migrating the SSL UI tests to be browser tests (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | chrome/test/data/ssl/google.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "base/message_loop.h" 5 #include "base/message_loop.h"
6 #include "chrome/browser/browser.h" 6 #include "chrome/browser/browser.h"
7 #include "chrome/browser/find_notification_details.h" 7 #include "chrome/browser/find_notification_details.h"
8 #include "chrome/browser/renderer_host/render_view_host.h" 8 #include "chrome/browser/renderer_host/render_view_host.h"
9 #include "chrome/browser/tab_contents/tab_contents.h" 9 #include "chrome/browser/tab_contents/tab_contents.h"
10 #include "chrome/browser/tab_contents/tab_contents_view.h" 10 #include "chrome/browser/tab_contents/tab_contents_view.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // Try again case sensitive, but this time with right case. 142 // Try again case sensitive, but this time with right case.
143 EXPECT_EQ(1, FindInPage(L"dog", FWD, CASE_SENSITIVE, false)); 143 EXPECT_EQ(1, FindInPage(L"dog", FWD, CASE_SENSITIVE, false));
144 144
145 // Try non-Latin characters ('Hreggvidur' with 'eth' for 'd' in left frame). 145 // Try non-Latin characters ('Hreggvidur' with 'eth' for 'd' in left frame).
146 EXPECT_EQ(1, FindInPage(L"Hreggvi\u00F0ur", FWD, IGNORE_CASE, false)); 146 EXPECT_EQ(1, FindInPage(L"Hreggvi\u00F0ur", FWD, IGNORE_CASE, false));
147 EXPECT_EQ(1, FindInPage(L"Hreggvi\u00F0ur", FWD, CASE_SENSITIVE, false)); 147 EXPECT_EQ(1, FindInPage(L"Hreggvi\u00F0ur", FWD, CASE_SENSITIVE, false));
148 EXPECT_EQ(0, FindInPage(L"hreggvi\u00F0ur", FWD, CASE_SENSITIVE, false)); 148 EXPECT_EQ(0, FindInPage(L"hreggvi\u00F0ur", FWD, CASE_SENSITIVE, false));
149 } 149 }
150 150
151 std::string FocusedOnPage(WebContents* web_contents) { 151 std::string FocusedOnPage(WebContents* web_contents) {
152 ui_test_utils::JavaScriptRunner js_runner( 152 std::string result;
153 ui_test_utils::ExecuteJavaScriptAndExtractString(
153 web_contents, 154 web_contents,
154 L"", 155 L"",
155 L"window.domAutomationController.send(getFocusedElement());"); 156 L"window.domAutomationController.send(getFocusedElement());",
156 return js_runner.Run(); 157 &result);
158 return result;
157 } 159 }
158 160
159 // This tests the FindInPage end-state, in other words: what is focused when you 161 // This tests the FindInPage end-state, in other words: what is focused when you
160 // close the Find box (ie. if you find within a link the link should be 162 // close the Find box (ie. if you find within a link the link should be
161 // focused). 163 // focused).
162 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageEndState) { 164 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageEndState) {
163 HTTPTestServer* server = StartHTTPServer(); 165 HTTPTestServer* server = StartHTTPServer();
164 166
165 // First we navigate to our special focus tracking page. 167 // First we navigate to our special focus tracking page.
166 GURL url = server->TestServerPageW(kEndState); 168 GURL url = server->TestServerPageW(kEndState);
(...skipping 12 matching lines...) Expand all
179 // End the find session, which should set focus to the link. 181 // End the find session, which should set focus to the link.
180 web_contents->StopFinding(false); 182 web_contents->StopFinding(false);
181 183
182 // Verify that the link is focused. 184 // Verify that the link is focused.
183 EXPECT_STREQ("link1", FocusedOnPage(web_contents).c_str()); 185 EXPECT_STREQ("link1", FocusedOnPage(web_contents).c_str());
184 186
185 // Search for a text that exists within a link on the page. 187 // Search for a text that exists within a link on the page.
186 EXPECT_EQ(1, FindInPage(L"Google", FWD, IGNORE_CASE, false)); 188 EXPECT_EQ(1, FindInPage(L"Google", FWD, IGNORE_CASE, false));
187 189
188 // Move the selection to link 1, after searching. 190 // Move the selection to link 1, after searching.
189 ui_test_utils::JavaScriptRunner js_runner( 191 std::string result;
192 ui_test_utils::ExecuteJavaScriptAndExtractString(
190 web_contents, 193 web_contents,
191 L"", 194 L"",
192 L"window.domAutomationController.send(selectLink1());"); 195 L"window.domAutomationController.send(selectLink1());",
193 js_runner.Run(); 196 &result);
194 197
195 // End the find session. 198 // End the find session.
196 web_contents->StopFinding(false); 199 web_contents->StopFinding(false);
197 200
198 // Verify that link2 is not focused. 201 // Verify that link2 is not focused.
199 EXPECT_STREQ("", FocusedOnPage(web_contents).c_str()); 202 EXPECT_STREQ("", FocusedOnPage(web_contents).c_str());
200 } 203 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | chrome/test/data/ssl/google.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698