| OLD | NEW |
| 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 "chrome/common/extensions/extension_file_util.h" | 5 #include "chrome/common/extensions/extension_file_util.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/json/json_string_value_serializer.h" | 9 #include "base/json/json_string_value_serializer.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/common/chrome_paths.h" | 13 #include "chrome/common/chrome_paths.h" |
| 14 #include "chrome/common/extensions/extension.h" | 14 #include "chrome/common/extensions/extension.h" |
| 15 #include "chrome/common/extensions/extension_manifest_constants.h" | |
| 16 #include "chrome/common/extensions/manifest.h" | 15 #include "chrome/common/extensions/manifest.h" |
| 17 #include "extensions/common/constants.h" | 16 #include "extensions/common/constants.h" |
| 17 #include "extensions/common/manifest_constants.h" |
| 18 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
| 19 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 22 | 22 |
| 23 using extensions::Extension; | 23 using extensions::Extension; |
| 24 using extensions::Manifest; | 24 using extensions::Manifest; |
| 25 | 25 |
| 26 namespace keys = extension_manifest_keys; | 26 namespace keys = extensions::manifest_keys; |
| 27 | 27 |
| 28 class ExtensionFileUtilTest : public testing::Test { | 28 class ExtensionFileUtilTest : public testing::Test { |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 TEST_F(ExtensionFileUtilTest, InstallUninstallGarbageCollect) { | 31 TEST_F(ExtensionFileUtilTest, InstallUninstallGarbageCollect) { |
| 32 base::ScopedTempDir temp; | 32 base::ScopedTempDir temp; |
| 33 ASSERT_TRUE(temp.CreateUniqueTempDir()); | 33 ASSERT_TRUE(temp.CreateUniqueTempDir()); |
| 34 | 34 |
| 35 // Create a source extension. | 35 // Create a source extension. |
| 36 std::string extension_id("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); | 36 std::string extension_id("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 scoped_refptr<Extension> extension3(extension_file_util::LoadExtension( | 567 scoped_refptr<Extension> extension3(extension_file_util::LoadExtension( |
| 568 ext_dir, Manifest::UNPACKED, Extension::NO_FLAGS, &error)); | 568 ext_dir, Manifest::UNPACKED, Extension::NO_FLAGS, &error)); |
| 569 EXPECT_TRUE(extension3.get() == NULL); | 569 EXPECT_TRUE(extension3.get() == NULL); |
| 570 EXPECT_STREQ("Could not load icon 'icon.png' for page action.", | 570 EXPECT_STREQ("Could not load icon 'icon.png' for page action.", |
| 571 error.c_str()); | 571 error.c_str()); |
| 572 } | 572 } |
| 573 | 573 |
| 574 // TODO(aa): More tests as motivation allows. Maybe steal some from | 574 // TODO(aa): More tests as motivation allows. Maybe steal some from |
| 575 // ExtensionService? Many of them could probably be tested here without the | 575 // ExtensionService? Many of them could probably be tested here without the |
| 576 // MessageLoop shenanigans. | 576 // MessageLoop shenanigans. |
| OLD | NEW |