OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 // If this test flakes, use bug 22111. | 302 // If this test flakes, use bug 22111. |
303 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, HistorySearchXSS) { | 303 IN_PROC_BROWSER_TEST_F(HistoryBrowserTest, HistorySearchXSS) { |
304 GURL url(std::string(chrome::kChromeUIHistoryURL) + | 304 GURL url(std::string(chrome::kChromeUIHistoryURL) + |
305 "#q=%3Cimg%20src%3Dx%3Ax%20onerror%3D%22document.title%3D'XSS'%22%3E"); | 305 "#q=%3Cimg%20src%3Dx%3Ax%20onerror%3D%22document.title%3D'XSS'%22%3E"); |
306 ui_test_utils::NavigateToURL(browser(), url); | 306 ui_test_utils::NavigateToURL(browser(), url); |
307 // Mainly, this is to ensure we send a synchronous message to the renderer | 307 // Mainly, this is to ensure we send a synchronous message to the renderer |
308 // so that we're not susceptible (less susceptible?) to a race condition. | 308 // so that we're not susceptible (less susceptible?) to a race condition. |
309 // Should a race condition ever trigger, it won't result in flakiness. | 309 // Should a race condition ever trigger, it won't result in flakiness. |
310 int num = ui_test_utils::FindInPage( | 310 int num = ui_test_utils::FindInPage( |
311 chrome::GetActiveTabContents(browser()), ASCIIToUTF16("<img"), true, | 311 chrome::GetActiveTabContents(browser()), ASCIIToUTF16("<img"), true, |
312 true, NULL); | 312 true, NULL, NULL); |
313 EXPECT_GT(num, 0); | 313 EXPECT_GT(num, 0); |
314 EXPECT_EQ(ASCIIToUTF16("History"), | 314 EXPECT_EQ(ASCIIToUTF16("History"), |
315 chrome::GetActiveWebContents(browser())->GetTitle()); | 315 chrome::GetActiveWebContents(browser())->GetTitle()); |
316 } | 316 } |
OLD | NEW |