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

Side by Side Diff: chrome/browser/extensions/convert_user_script_unittest.cc

Issue 10696176: Move UserScript and related into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Latest master for cq Created 8 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/scoped_temp_dir.h" 12 #include "base/scoped_temp_dir.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/extensions/convert_user_script.h" 14 #include "chrome/browser/extensions/convert_user_script.h"
15 #include "chrome/common/chrome_paths.h" 15 #include "chrome/common/chrome_paths.h"
16 #include "chrome/common/extensions/extension.h" 16 #include "chrome/common/extensions/extension.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 using extensions::Extension;
20
21 namespace { 19 namespace {
22 20
23 static void AddPattern(URLPatternSet* extent, const std::string& pattern) { 21 static void AddPattern(URLPatternSet* extent, const std::string& pattern) {
24 int schemes = URLPattern::SCHEME_ALL; 22 int schemes = URLPattern::SCHEME_ALL;
25 extent->AddPattern(URLPattern(schemes, pattern)); 23 extent->AddPattern(URLPattern(schemes, pattern));
26 } 24 }
27 25
28 } 26 }
29 27
28 namespace extensions {
29
30 TEST(ExtensionFromUserScript, Basic) { 30 TEST(ExtensionFromUserScript, Basic) {
31 FilePath test_file; 31 FilePath test_file;
32 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_file)); 32 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_file));
33 test_file = test_file.AppendASCII("extensions") 33 test_file = test_file.AppendASCII("extensions")
34 .AppendASCII("user_script_basic.user.js"); 34 .AppendASCII("user_script_basic.user.js");
35 35
36 string16 error; 36 string16 error;
37 scoped_refptr<Extension> extension(ConvertUserScriptToExtension( 37 scoped_refptr<Extension> extension(ConvertUserScriptToExtension(
38 test_file, GURL("http://www.google.com/foo"), &error)); 38 test_file, GURL("http://www.google.com/foo"), &error));
39 39
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 EXPECT_EQ("Document Idle Test", extension->name()); 210 EXPECT_EQ("Document Idle Test", extension->name());
211 EXPECT_EQ("This script tests document-idle", extension->description()); 211 EXPECT_EQ("This script tests document-idle", extension->description());
212 EXPECT_EQ("kHnHKec3O/RKKo5/Iu1hKqe4wQERthL0639isNtsfiY=", 212 EXPECT_EQ("kHnHKec3O/RKKo5/Iu1hKqe4wQERthL0639isNtsfiY=",
213 extension->public_key()); 213 extension->public_key());
214 214
215 // Validate run location. 215 // Validate run location.
216 ASSERT_EQ(1u, extension->content_scripts().size()); 216 ASSERT_EQ(1u, extension->content_scripts().size());
217 const UserScript& script = extension->content_scripts()[0]; 217 const UserScript& script = extension->content_scripts()[0];
218 EXPECT_EQ(UserScript::DOCUMENT_IDLE, script.run_location()); 218 EXPECT_EQ(UserScript::DOCUMENT_IDLE, script.run_location());
219 } 219 }
220
221 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/convert_user_script.cc ('k') | chrome/browser/extensions/crx_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698