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 "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/scoped_temp_dir.h" | 7 #include "base/scoped_temp_dir.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 // Try bots won't let us write into DIR_TEST_DATA, so we have to create | 29 // Try bots won't let us write into DIR_TEST_DATA, so we have to create |
30 // a temp folder to play in. | 30 // a temp folder to play in. |
31 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 31 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
32 | 32 |
33 FilePath crx_path = temp_dir_.path().AppendASCII(crx_name); | 33 FilePath crx_path = temp_dir_.path().AppendASCII(crx_name); |
34 ASSERT_TRUE(file_util::CopyFile(original_path, crx_path)) << | 34 ASSERT_TRUE(file_util::CopyFile(original_path, crx_path)) << |
35 "Original path " << original_path.value() << | 35 "Original path " << original_path.value() << |
36 ", Crx path " << crx_path.value(); | 36 ", Crx path " << crx_path.value(); |
37 | 37 |
38 unpacker_.reset(new ExtensionUnpacker(crx_path)); | 38 unpacker_.reset( |
| 39 new ExtensionUnpacker( |
| 40 crx_path, Extension::INTERNAL, Extension::NO_FLAGS)); |
39 } | 41 } |
40 | 42 |
41 protected: | 43 protected: |
42 ScopedTempDir temp_dir_; | 44 ScopedTempDir temp_dir_; |
43 scoped_ptr<ExtensionUnpacker> unpacker_; | 45 scoped_ptr<ExtensionUnpacker> unpacker_; |
44 }; | 46 }; |
45 | 47 |
46 TEST_F(ExtensionUnpackerTest, EmptyDefaultLocale) { | 48 TEST_F(ExtensionUnpackerTest, EmptyDefaultLocale) { |
47 SetupUnpacker("empty_default_locale.crx"); | 49 SetupUnpacker("empty_default_locale.crx"); |
48 EXPECT_FALSE(unpacker_->Run()); | 50 EXPECT_FALSE(unpacker_->Run()); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 EXPECT_TRUE(unpacker_->error_message().empty()); | 104 EXPECT_TRUE(unpacker_->error_message().empty()); |
103 ASSERT_EQ(2U, unpacker_->parsed_catalogs()->size()); | 105 ASSERT_EQ(2U, unpacker_->parsed_catalogs()->size()); |
104 } | 106 } |
105 | 107 |
106 TEST_F(ExtensionUnpackerTest, NoL10n) { | 108 TEST_F(ExtensionUnpackerTest, NoL10n) { |
107 SetupUnpacker("no_l10n.crx"); | 109 SetupUnpacker("no_l10n.crx"); |
108 EXPECT_TRUE(unpacker_->Run()); | 110 EXPECT_TRUE(unpacker_->Run()); |
109 EXPECT_TRUE(unpacker_->error_message().empty()); | 111 EXPECT_TRUE(unpacker_->error_message().empty()); |
110 EXPECT_EQ(0U, unpacker_->parsed_catalogs()->size()); | 112 EXPECT_EQ(0U, unpacker_->parsed_catalogs()->size()); |
111 } | 113 } |
OLD | NEW |