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

Side by Side Diff: chrome/common/extensions/user_script_unittest.cc

Issue 256022: Loads local resources from current locale subtree if available, if not it fal... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 | « chrome/common/extensions/user_script.h ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "base/file_path.h" 5 #include "base/file_path.h"
6 #include "base/pickle.h" 6 #include "base/pickle.h"
7 #include "chrome/common/extensions/user_script.h" 7 #include "chrome/common/extensions/user_script.h"
8 #include "googleurl/src/gurl.h" 8 #include "googleurl/src/gurl.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 71 }
72 72
73 TEST(UserScriptTest, Pickle) { 73 TEST(UserScriptTest, Pickle) {
74 URLPattern pattern1; 74 URLPattern pattern1;
75 URLPattern pattern2; 75 URLPattern pattern2;
76 ASSERT_TRUE(pattern1.Parse("http://*/foo*")); 76 ASSERT_TRUE(pattern1.Parse("http://*/foo*"));
77 ASSERT_TRUE(pattern2.Parse("http://bar/baz*")); 77 ASSERT_TRUE(pattern2.Parse("http://bar/baz*"));
78 78
79 UserScript script1; 79 UserScript script1;
80 script1.js_scripts().push_back(UserScript::File( 80 script1.js_scripts().push_back(UserScript::File(
81 FilePath(FILE_PATH_LITERAL("c:\\foo\\foo.user.js")), 81 ExtensionResource(FilePath(FILE_PATH_LITERAL("c:\\foo\\")),
82 FilePath(FILE_PATH_LITERAL("foo.user.js"))),
82 GURL("chrome-user-script:/foo.user.js"))); 83 GURL("chrome-user-script:/foo.user.js")));
83 script1.css_scripts().push_back(UserScript::File( 84 script1.css_scripts().push_back(UserScript::File(
84 FilePath(FILE_PATH_LITERAL("c:\\foo\\foo.user.css")), 85 ExtensionResource(FilePath(FILE_PATH_LITERAL("c:\\foo\\")),
86 FilePath(FILE_PATH_LITERAL("foo.user.css"))),
85 GURL("chrome-user-script:/foo.user.css"))); 87 GURL("chrome-user-script:/foo.user.css")));
86 script1.css_scripts().push_back(UserScript::File( 88 script1.css_scripts().push_back(UserScript::File(
87 FilePath(FILE_PATH_LITERAL("c:\\foo\\foo2.user.css")), 89 ExtensionResource(FilePath(FILE_PATH_LITERAL("c:\\foo\\")),
90 FilePath(FILE_PATH_LITERAL("foo2.user.css"))),
88 GURL("chrome-user-script:/foo2.user.css"))); 91 GURL("chrome-user-script:/foo2.user.css")));
89 script1.set_run_location(UserScript::DOCUMENT_START); 92 script1.set_run_location(UserScript::DOCUMENT_START);
90 93
91 script1.add_url_pattern(pattern1); 94 script1.add_url_pattern(pattern1);
92 script1.add_url_pattern(pattern2); 95 script1.add_url_pattern(pattern2);
93 96
94 Pickle pickle; 97 Pickle pickle;
95 script1.Pickle(&pickle); 98 script1.Pickle(&pickle);
96 99
97 void* iter = NULL; 100 void* iter = NULL;
(...skipping 16 matching lines...) Expand all
114 for (size_t i = 0; i < script1.url_patterns().size(); ++i) { 117 for (size_t i = 0; i < script1.url_patterns().size(); ++i) {
115 EXPECT_EQ(script1.url_patterns()[i].GetAsString(), 118 EXPECT_EQ(script1.url_patterns()[i].GetAsString(),
116 script2.url_patterns()[i].GetAsString()); 119 script2.url_patterns()[i].GetAsString());
117 } 120 }
118 } 121 }
119 122
120 TEST(UserScriptTest, Defaults) { 123 TEST(UserScriptTest, Defaults) {
121 UserScript script; 124 UserScript script;
122 ASSERT_EQ(UserScript::DOCUMENT_END, script.run_location()); 125 ASSERT_EQ(UserScript::DOCUMENT_END, script.run_location());
123 } 126 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/user_script.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698