| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/files/file_path.h" | 5 #include "base/files/file_path.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "chrome/common/chrome_paths.h" | 7 #include "chrome/common/chrome_paths.h" |
| 8 #include "extensions/browser/component_extension_resource_manager.h" | 8 #include "extensions/browser/component_extension_resource_manager.h" |
| 9 #include "extensions/browser/extensions_browser_client.h" | 9 #include "extensions/browser/extensions_browser_client.h" |
| 10 #include "extensions/common/constants.h" | 10 #include "extensions/common/constants.h" |
| 11 #include "extensions/common/extension.h" | 11 #include "extensions/common/extension.h" |
| 12 #include "extensions/common/extension_icon_set.h" | 12 #include "extensions/common/extension_icon_set.h" |
| 13 #include "extensions/common/extension_resource.h" | 13 #include "extensions/common/extension_resource.h" |
| 14 #include "extensions/common/file_util.h" | 14 #include "extensions/common/file_util.h" |
| 15 #include "extensions/common/manifest.h" | 15 #include "extensions/common/manifest.h" |
| 16 #include "extensions/common/manifest_handlers/icons_handler.h" | 16 #include "extensions/common/manifest_handlers/icons_handler.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 18 |
| 19 #if defined(OS_CHROMEOS) | 19 #if defined(OS_CHROMEOS) |
| 20 #include "ui/file_manager/grit/file_manager_resources.h" | 20 #include "ui/file_manager/grit/file_manager_resources.h" |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 namespace extensions { | 23 namespace extensions { |
| 24 | 24 |
| 25 typedef testing::Test ChromeComponentExtensionResourceManagerTest; | 25 typedef testing::Test ChromeComponentExtensionResourceManagerTest; |
| 26 | 26 |
| 27 // Tests IsComponentExtensionResource function. | 27 // Tests IsComponentExtensionResource function. |
| 28 TEST_F(ChromeComponentExtensionResourceManagerTest, | 28 TEST_F(ChromeComponentExtensionResourceManagerTest, |
| 29 IsComponentExtensionResource) { | 29 IsComponentExtensionResource) { |
| 30 ComponentExtensionResourceManager* resource_manager = | 30 const ComponentExtensionResourceManager* resource_manager = |
| 31 ExtensionsBrowserClient::Get()->GetComponentExtensionResourceManager(); | 31 ExtensionsBrowserClient::Get()->GetComponentExtensionResourceManager(); |
| 32 ASSERT_TRUE(resource_manager); | 32 ASSERT_TRUE(resource_manager); |
| 33 | 33 |
| 34 // Get the extension test data path. | 34 // Get the extension test data path. |
| 35 base::FilePath test_path; | 35 base::FilePath test_path; |
| 36 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_path)); | 36 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_path)); |
| 37 test_path = test_path.AppendASCII("extensions").AppendASCII("file_manager"); | 37 test_path = test_path.AppendASCII("extensions").AppendASCII("file_manager"); |
| 38 | 38 |
| 39 // Load the manifest data. | 39 // Load the manifest data. |
| 40 std::string error; | 40 std::string error; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 65 #if defined(OS_CHROMEOS) | 65 #if defined(OS_CHROMEOS) |
| 66 // The resource is a component resource. | 66 // The resource is a component resource. |
| 67 int resource_id = 0; | 67 int resource_id = 0; |
| 68 ASSERT_TRUE(resource_manager->IsComponentExtensionResource( | 68 ASSERT_TRUE(resource_manager->IsComponentExtensionResource( |
| 69 extension->path(), resource.relative_path(), &resource_id)); | 69 extension->path(), resource.relative_path(), &resource_id)); |
| 70 ASSERT_EQ(IDR_FILE_MANAGER_ICON_16, resource_id); | 70 ASSERT_EQ(IDR_FILE_MANAGER_ICON_16, resource_id); |
| 71 #endif | 71 #endif |
| 72 } | 72 } |
| 73 | 73 |
| 74 } // namespace extensions | 74 } // namespace extensions |
| OLD | NEW |