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

Side by Side Diff: chrome/browser/extensions/user_script_master_unittest.cc

Issue 420001: Ignore UTF-8's BOM when parsing userscript's metadata. (Closed)
Patch Set: Relect the review Created 11 years 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
« no previous file with comments | « chrome/browser/extensions/user_script_master.cc ('k') | no next file » | 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) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/browser/extensions/user_script_master.h" 5 #include "chrome/browser/extensions/user_script_master.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 "// ==UserScript==\n" 211 "// ==UserScript==\n"
212 "// @include http://*.mail.google.com/*\n" 212 "// @include http://*.mail.google.com/*\n"
213 "// @match \t http://mail.yahoo.com/*\n" 213 "// @match \t http://mail.yahoo.com/*\n"
214 "// ==/UserScript==\n"); 214 "// ==/UserScript==\n");
215 215
216 // Allowed to match @include and @match. 216 // Allowed to match @include and @match.
217 UserScript script; 217 UserScript script;
218 EXPECT_TRUE(UserScriptMaster::ScriptReloader::ParseMetadataHeader( 218 EXPECT_TRUE(UserScriptMaster::ScriptReloader::ParseMetadataHeader(
219 text, &script)); 219 text, &script));
220 } 220 }
221
222 TEST_F(UserScriptMasterTest, Parse7) {
223 const std::string text(
224 "\xEF\xBB\xBF// ==UserScript==\n"
225 "// @match http://*.mail.google.com/*\n"
226 "// ==/UserScript==\n");
227
228 // Should Ignore UTF-8's BOM.
229 UserScript script;
230 EXPECT_TRUE(UserScriptMaster::ScriptReloader::ParseMetadataHeader(
231 text, &script));
232 ASSERT_EQ(1U, script.url_patterns().size());
233 EXPECT_EQ("http://*.mail.google.com/*",
234 script.url_patterns()[0].GetAsString());
235 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/user_script_master.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698