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

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_view_unittest.cc

Issue 7585016: Add unit test for javascript: URL stripping (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 | « no previous file | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/omnibox/omnibox_view.h"
6 #include "base/string16.h"
7 #include "base/string_util.h"
8 #include "base/utf_string_conversions.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 TEST(OmniboxView, TestStripSchemasUnsafeForPaste) {
12 const char* urls[] = {
13 "http://www.google.com?q=javascript:alert(0)", // Safe URL.
14 "javAscript:alert(0)", // Unsafe JS URL.
15 "jaVascript:\njavaScript: alert(0)" // Single strip unsafe.
16 };
17
18 const char* expecteds[] = {
19 "http://www.google.com?q=javascript:alert(0)", // Safe URL.
20 "alert(0)", // Unsafe JS URL.
21 "alert(0)" // Single strip unsafe.
22 };
23
24 for (size_t i = 0; i < arraysize(urls); i++) {
25 EXPECT_EQ(ASCIIToUTF16(expecteds[i]),
26 OmniboxView::StripJavascriptSchemas(ASCIIToUTF16(urls[i])));
27 }
28 }
OLDNEW
« no previous file with comments | « no previous file | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698