| OLD | NEW |
| 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 <stddef.h> |
| 6 #include <stdint.h> |
| 7 |
| 6 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 7 #include "base/pickle.h" | 9 #include "base/pickle.h" |
| 8 #include "extensions/common/user_script.h" | 10 #include "extensions/common/user_script.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 11 | 13 |
| 12 namespace extensions { | 14 namespace extensions { |
| 13 | 15 |
| 14 static const int kAllSchemes = | 16 static const int kAllSchemes = |
| 15 URLPattern::SCHEME_HTTP | | 17 URLPattern::SCHEME_HTTP | |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 base::FilePath(FILE_PATH_LITERAL("c:\\foo\\")), | 185 base::FilePath(FILE_PATH_LITERAL("c:\\foo\\")), |
| 184 base::FilePath(FILE_PATH_LITERAL("foo2.user.css")), | 186 base::FilePath(FILE_PATH_LITERAL("foo2.user.css")), |
| 185 GURL("chrome-extension://abc/foo2.user.css"))); | 187 GURL("chrome-extension://abc/foo2.user.css"))); |
| 186 script1.set_run_location(UserScript::DOCUMENT_START); | 188 script1.set_run_location(UserScript::DOCUMENT_START); |
| 187 | 189 |
| 188 script1.add_url_pattern(pattern1); | 190 script1.add_url_pattern(pattern1); |
| 189 script1.add_url_pattern(pattern2); | 191 script1.add_url_pattern(pattern2); |
| 190 script1.add_exclude_url_pattern(exclude1); | 192 script1.add_exclude_url_pattern(exclude1); |
| 191 script1.add_exclude_url_pattern(exclude2); | 193 script1.add_exclude_url_pattern(exclude2); |
| 192 | 194 |
| 193 const int64 kId = 12; | 195 const int64_t kId = 12; |
| 194 script1.set_id(kId); | 196 script1.set_id(kId); |
| 195 const std::string kExtensionId = "foo"; | 197 const std::string kExtensionId = "foo"; |
| 196 HostID id(HostID::EXTENSIONS, kExtensionId); | 198 HostID id(HostID::EXTENSIONS, kExtensionId); |
| 197 script1.set_host_id(id); | 199 script1.set_host_id(id); |
| 198 | 200 |
| 199 base::Pickle pickle; | 201 base::Pickle pickle; |
| 200 script1.Pickle(&pickle); | 202 script1.Pickle(&pickle); |
| 201 | 203 |
| 202 base::PickleIterator iter(pickle); | 204 base::PickleIterator iter(pickle); |
| 203 UserScript script2; | 205 UserScript script2; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 222 EXPECT_EQ(kExtensionId, script2.extension_id()); | 224 EXPECT_EQ(kExtensionId, script2.extension_id()); |
| 223 EXPECT_EQ(kId, script2.id()); | 225 EXPECT_EQ(kId, script2.id()); |
| 224 } | 226 } |
| 225 | 227 |
| 226 TEST(ExtensionUserScriptTest, Defaults) { | 228 TEST(ExtensionUserScriptTest, Defaults) { |
| 227 UserScript script; | 229 UserScript script; |
| 228 ASSERT_EQ(UserScript::DOCUMENT_IDLE, script.run_location()); | 230 ASSERT_EQ(UserScript::DOCUMENT_IDLE, script.run_location()); |
| 229 } | 231 } |
| 230 | 232 |
| 231 } // namespace extensions | 233 } // namespace extensions |
| OLD | NEW |