| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/scoped_temp_dir.h" | |
| 12 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/scoped_temp_dir.h" |
| 13 #include "chrome/browser/extensions/convert_user_script.h" | 13 #include "chrome/browser/extensions/convert_user_script.h" |
| 14 #include "chrome/common/chrome_paths.h" | 14 #include "chrome/common/chrome_paths.h" |
| 15 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 TEST(ExtensionFromUserScript, Basic) { | 18 TEST(ExtensionFromUserScript, Basic) { |
| 19 FilePath test_file; | 19 FilePath test_file; |
| 20 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_file)); | 20 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_file)); |
| 21 test_file = test_file.AppendASCII("extensions") | 21 test_file = test_file.AppendASCII("extensions") |
| 22 .AppendASCII("user_script_basic.user.js"); | 22 .AppendASCII("user_script_basic.user.js"); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 EXPECT_EQ("Document Idle Test", extension->name()); | 192 EXPECT_EQ("Document Idle Test", extension->name()); |
| 193 EXPECT_EQ("This script tests document-idle", extension->description()); | 193 EXPECT_EQ("This script tests document-idle", extension->description()); |
| 194 EXPECT_EQ("kHnHKec3O/RKKo5/Iu1hKqe4wQERthL0639isNtsfiY=", | 194 EXPECT_EQ("kHnHKec3O/RKKo5/Iu1hKqe4wQERthL0639isNtsfiY=", |
| 195 extension->public_key()); | 195 extension->public_key()); |
| 196 | 196 |
| 197 // Validate run location. | 197 // Validate run location. |
| 198 ASSERT_EQ(1u, extension->content_scripts().size()); | 198 ASSERT_EQ(1u, extension->content_scripts().size()); |
| 199 const UserScript& script = extension->content_scripts()[0]; | 199 const UserScript& script = extension->content_scripts()[0]; |
| 200 EXPECT_EQ(UserScript::DOCUMENT_IDLE, script.run_location()); | 200 EXPECT_EQ(UserScript::DOCUMENT_IDLE, script.run_location()); |
| 201 } | 201 } |
| OLD | NEW |