| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |