Chromium Code Reviews| Index: chrome/browser/extensions/pack_extension_unittest.cc |
| diff --git a/chrome/browser/extensions/pack_extension_unittest.cc b/chrome/browser/extensions/pack_extension_unittest.cc |
| index dac4608553cd26ad25b5c1ae170c931fb3fff57b..be50727930f409d0478c4bfa0453f9ae16db26d5 100644 |
| --- a/chrome/browser/extensions/pack_extension_unittest.cc |
| +++ b/chrome/browser/extensions/pack_extension_unittest.cc |
| @@ -38,6 +38,19 @@ class PackExtensionTest : public testing::Test { |
| return startup_helper_.PackExtension(command_line); |
| } |
| + bool TestPackExtensionKey(const base::FilePath& path, |
| + const base::FilePath& key_path) { |
| + base::ScopedTempDir temp_dir; |
| + EXPECT_TRUE(temp_dir.CreateUniqueTempDir()); |
| + EXPECT_TRUE(base::CopyDirectory(path, temp_dir.path(), true)); |
| + CommandLine command_line(CommandLine::NO_PROGRAM); |
| + command_line.AppendSwitchPath(switches::kPackExtension, |
| + temp_dir.path().Append(path.BaseName())); |
| + command_line.AppendSwitchPath(switches::kPackExtensionKey, |
| + temp_dir.path().Append(key_path.BaseName())); |
| + return startup_helper_.PackExtension(command_line); |
| + } |
| + |
| base::MessageLoop message_loop_; |
| content::TestBrowserThread ui_thread_; |
| content::TestBrowserThread file_thread_; |
| @@ -61,4 +74,11 @@ TEST_F(PackExtensionTest, PlatformApp) { |
| .AppendASCII("minimal"))); |
| } |
| +TEST_F(PackExtensionTest, ExtensionWithInvalidKey) { |
|
zhchbin
2013/07/27 00:33:24
Why don't you put this code to the ExtensionServic
|
| + ASSERT_FALSE(TestPackExtensionKey(test_data_dir_. |
| + AppendASCII("bad_private_key"), |
| + test_data_dir_. |
| + AppendASCII("bad_private_key.pem"))); |
| +} |
| + |
| } // namespace extensions |