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

Unified Diff: chrome/browser/autocomplete/autocomplete_unittest.cc

Issue 62094: Emaphasize "https" instead of "view-source" when user accesses secure/insecur... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit_view_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/autocomplete_unittest.cc
===================================================================
--- chrome/browser/autocomplete/autocomplete_unittest.cc (revision 13588)
+++ chrome/browser/autocomplete/autocomplete_unittest.cc (working copy)
@@ -278,4 +278,49 @@
}
}
+TEST(AutocompleteInput, ParseForEmphasizeComponent) {
+ using url_parse::Component;
+ Component kInvalidComponent(0, -1);
+ struct test_data {
+ const wchar_t* input;
+ const Component scheme;
+ const Component host;
+ } input_cases[] = {
+ { L"", kInvalidComponent, kInvalidComponent },
+ { L"?", kInvalidComponent, kInvalidComponent },
+ { L"?http://foo.com/bar", kInvalidComponent, kInvalidComponent },
+ { L"foo/bar baz", kInvalidComponent, Component(0, 3) },
+ { L"http://foo/bar baz", Component(0, 4), Component(7, 3) },
+ { L"link:foo.com", Component(0, 4), kInvalidComponent },
+ { L"www.foo.com:81", kInvalidComponent, Component(0, 11) },
+ { L"\u6d4b\u8bd5", kInvalidComponent, Component(0, 2) },
+ { L"view-source:http://www.foo.com/", Component(12, 4), Component(19, 11) },
+ { L"view-source:https://example.com/",
+ Component(12, 5), Component(20, 11) },
+ { L"view-source:", Component(0, 11), kInvalidComponent },
+ { L"view-source:garbage", kInvalidComponent, Component(12, 7) },
+ { L"view-source:http://http://foo", Component(12, 4), Component(19, 4) },
+ { L"view-source:view-source:http://example.com/",
+ Component(12, 11), kInvalidComponent }
+ };
+
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input_cases); ++i) {
+ Component scheme, host;
+ AutocompleteInput::ParseForEmphasizeComponents(input_cases[i].input,
+ std::wstring(),
+ &scheme,
+ &host);
+ AutocompleteInput input(input_cases[i].input, std::wstring(), true, false,
+ false);
+ EXPECT_EQ(input_cases[i].scheme.begin, scheme.begin) << "Input: " <<
+ input_cases[i].input;
+ EXPECT_EQ(input_cases[i].scheme.len, scheme.len) << "Input: " <<
+ input_cases[i].input;
+ EXPECT_EQ(input_cases[i].host.begin, host.begin) << "Input: " <<
+ input_cases[i].input;
+ EXPECT_EQ(input_cases[i].host.len, host.len) << "Input: " <<
+ input_cases[i].input;
+ }
+}
+
} // namespace
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit_view_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698