| 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" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 using extensions::Manifest; | 26 using extensions::Manifest; |
| 27 | 27 |
| 28 namespace keys = extension_manifest_keys; | 28 namespace keys = extension_manifest_keys; |
| 29 | 29 |
| 30 class ExtensionFileUtilTest : public testing::Test { | 30 class ExtensionFileUtilTest : public testing::Test { |
| 31 protected: | 31 protected: |
| 32 virtual void SetUp() OVERRIDE { | 32 virtual void SetUp() OVERRIDE { |
| 33 testing::Test::SetUp(); | 33 testing::Test::SetUp(); |
| 34 extensions::ManifestHandler::Register( | 34 extensions::ManifestHandler::Register( |
| 35 extension_manifest_keys::kBrowserAction, | 35 extension_manifest_keys::kBrowserAction, |
| 36 new extensions::BrowserActionHandler); | 36 make_linked_ptr(new extensions::BrowserActionHandler)); |
| 37 extensions::ManifestHandler::Register( | 37 extensions::ManifestHandler::Register( |
| 38 keys::kDefaultLocale, | 38 keys::kDefaultLocale, |
| 39 new extensions::DefaultLocaleHandler); | 39 make_linked_ptr(new extensions::DefaultLocaleHandler)); |
| 40 } | 40 } |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 #if defined(OS_WIN) | 43 #if defined(OS_WIN) |
| 44 // http://crbug.com/106381 | 44 // http://crbug.com/106381 |
| 45 #define InstallUninstallGarbageCollect DISABLED_InstallUninstallGarbageCollect | 45 #define InstallUninstallGarbageCollect DISABLED_InstallUninstallGarbageCollect |
| 46 #endif | 46 #endif |
| 47 TEST_F(ExtensionFileUtilTest, InstallUninstallGarbageCollect) { | 47 TEST_F(ExtensionFileUtilTest, InstallUninstallGarbageCollect) { |
| 48 base::ScopedTempDir temp; | 48 base::ScopedTempDir temp; |
| 49 ASSERT_TRUE(temp.CreateUniqueTempDir()); | 49 ASSERT_TRUE(temp.CreateUniqueTempDir()); |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 scoped_refptr<Extension> extension3(extension_file_util::LoadExtension( | 603 scoped_refptr<Extension> extension3(extension_file_util::LoadExtension( |
| 604 ext_dir, Manifest::LOAD, Extension::NO_FLAGS, &error)); | 604 ext_dir, Manifest::LOAD, Extension::NO_FLAGS, &error)); |
| 605 ASSERT_TRUE(extension3 == NULL); | 605 ASSERT_TRUE(extension3 == NULL); |
| 606 ASSERT_STREQ("Could not load icon 'icon.png' for page action.", | 606 ASSERT_STREQ("Could not load icon 'icon.png' for page action.", |
| 607 error.c_str()); | 607 error.c_str()); |
| 608 } | 608 } |
| 609 | 609 |
| 610 // TODO(aa): More tests as motivation allows. Maybe steal some from | 610 // TODO(aa): More tests as motivation allows. Maybe steal some from |
| 611 // ExtensionService? Many of them could probably be tested here without the | 611 // ExtensionService? Many of them could probably be tested here without the |
| 612 // MessageLoop shenanigans. | 612 // MessageLoop shenanigans. |
| OLD | NEW |