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

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

Issue 822453002: Introduce HostID and de-couple Extensions from "script injection System" [browser side] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 5 years, 11 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
« no previous file with comments | « extensions/common/user_script.cc ('k') | extensions/extensions.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/pickle.h" 7 #include "base/pickle.h"
8 #include "extensions/common/user_script.h" 8 #include "extensions/common/user_script.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "url/gurl.h" 10 #include "url/gurl.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 script1.set_run_location(UserScript::DOCUMENT_START); 186 script1.set_run_location(UserScript::DOCUMENT_START);
187 187
188 script1.add_url_pattern(pattern1); 188 script1.add_url_pattern(pattern1);
189 script1.add_url_pattern(pattern2); 189 script1.add_url_pattern(pattern2);
190 script1.add_exclude_url_pattern(exclude1); 190 script1.add_exclude_url_pattern(exclude1);
191 script1.add_exclude_url_pattern(exclude2); 191 script1.add_exclude_url_pattern(exclude2);
192 192
193 const int64 kId = 12; 193 const int64 kId = 12;
194 script1.set_id(kId); 194 script1.set_id(kId);
195 const std::string kExtensionId = "foo"; 195 const std::string kExtensionId = "foo";
196 script1.set_extension_id(kExtensionId); 196 HostID id(HostID::EXTENSIONS, kExtensionId);
197 script1.set_host_id(id);
197 198
198 Pickle pickle; 199 Pickle pickle;
199 script1.Pickle(&pickle); 200 script1.Pickle(&pickle);
200 201
201 PickleIterator iter(pickle); 202 PickleIterator iter(pickle);
202 UserScript script2; 203 UserScript script2;
203 script2.Unpickle(pickle, &iter); 204 script2.Unpickle(pickle, &iter);
204 205
205 EXPECT_EQ(1U, script2.js_scripts().size()); 206 EXPECT_EQ(1U, script2.js_scripts().size());
206 EXPECT_EQ(script1.js_scripts()[0].url(), script2.js_scripts()[0].url()); 207 EXPECT_EQ(script1.js_scripts()[0].url(), script2.js_scripts()[0].url());
(...skipping 14 matching lines...) Expand all
221 EXPECT_EQ(kExtensionId, script2.extension_id()); 222 EXPECT_EQ(kExtensionId, script2.extension_id());
222 EXPECT_EQ(kId, script2.id()); 223 EXPECT_EQ(kId, script2.id());
223 } 224 }
224 225
225 TEST(ExtensionUserScriptTest, Defaults) { 226 TEST(ExtensionUserScriptTest, Defaults) {
226 UserScript script; 227 UserScript script;
227 ASSERT_EQ(UserScript::DOCUMENT_IDLE, script.run_location()); 228 ASSERT_EQ(UserScript::DOCUMENT_IDLE, script.run_location());
228 } 229 }
229 230
230 } // namespace extensions 231 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/user_script.cc ('k') | extensions/extensions.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698