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

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

Issue 899983002: Revert of 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: rebase Created 5 years, 10 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 HostID id(HostID::EXTENSIONS, kExtensionId); 196 script1.set_extension_id(kExtensionId);
197 script1.set_host_id(id);
198 197
199 Pickle pickle; 198 Pickle pickle;
200 script1.Pickle(&pickle); 199 script1.Pickle(&pickle);
201 200
202 PickleIterator iter(pickle); 201 PickleIterator iter(pickle);
203 UserScript script2; 202 UserScript script2;
204 script2.Unpickle(pickle, &iter); 203 script2.Unpickle(pickle, &iter);
205 204
206 EXPECT_EQ(1U, script2.js_scripts().size()); 205 EXPECT_EQ(1U, script2.js_scripts().size());
207 EXPECT_EQ(script1.js_scripts()[0].url(), script2.js_scripts()[0].url()); 206 EXPECT_EQ(script1.js_scripts()[0].url(), script2.js_scripts()[0].url());
(...skipping 14 matching lines...) Expand all
222 EXPECT_EQ(kExtensionId, script2.extension_id()); 221 EXPECT_EQ(kExtensionId, script2.extension_id());
223 EXPECT_EQ(kId, script2.id()); 222 EXPECT_EQ(kId, script2.id());
224 } 223 }
225 224
226 TEST(ExtensionUserScriptTest, Defaults) { 225 TEST(ExtensionUserScriptTest, Defaults) {
227 UserScript script; 226 UserScript script;
228 ASSERT_EQ(UserScript::DOCUMENT_IDLE, script.run_location()); 227 ASSERT_EQ(UserScript::DOCUMENT_IDLE, script.run_location());
229 } 228 }
230 229
231 } // namespace extensions 230 } // 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