| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/browser/extensions/extension_service_unittest.h" | 5 #include "chrome/browser/extensions/extension_service_unittest.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 2159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2170 // Pack the extension once to get a private key. | 2170 // Pack the extension once to get a private key. |
| 2171 scoped_ptr<ExtensionCreator> creator(new ExtensionCreator()); | 2171 scoped_ptr<ExtensionCreator> creator(new ExtensionCreator()); |
| 2172 ASSERT_TRUE(creator->Run(input_directory, crx_path, base::FilePath(), | 2172 ASSERT_TRUE(creator->Run(input_directory, crx_path, base::FilePath(), |
| 2173 privkey_path, ExtensionCreator::kNoRunFlags)) | 2173 privkey_path, ExtensionCreator::kNoRunFlags)) |
| 2174 << creator->error_message(); | 2174 << creator->error_message(); |
| 2175 ASSERT_TRUE(file_util::PathExists(crx_path)); | 2175 ASSERT_TRUE(file_util::PathExists(crx_path)); |
| 2176 ASSERT_TRUE(file_util::PathExists(privkey_path)); | 2176 ASSERT_TRUE(file_util::PathExists(privkey_path)); |
| 2177 | 2177 |
| 2178 base::Delete(crx_path, false); | 2178 base::Delete(crx_path, false); |
| 2179 // Move the pem file into the extension. | 2179 // Move the pem file into the extension. |
| 2180 file_util::Move(privkey_path, | 2180 base::Move(privkey_path, |
| 2181 input_directory.AppendASCII("privkey.pem")); | 2181 input_directory.AppendASCII("privkey.pem")); |
| 2182 | 2182 |
| 2183 // This pack should fail because of the contained private key. | 2183 // This pack should fail because of the contained private key. |
| 2184 EXPECT_FALSE(creator->Run(input_directory, crx_path, base::FilePath(), | 2184 EXPECT_FALSE(creator->Run(input_directory, crx_path, base::FilePath(), |
| 2185 privkey_path, ExtensionCreator::kNoRunFlags)); | 2185 privkey_path, ExtensionCreator::kNoRunFlags)); |
| 2186 EXPECT_THAT(creator->error_message(), | 2186 EXPECT_THAT(creator->error_message(), |
| 2187 testing::ContainsRegex( | 2187 testing::ContainsRegex( |
| 2188 "extension includes the key file.*privkey.pem")); | 2188 "extension includes the key file.*privkey.pem")); |
| 2189 } | 2189 } |
| 2190 | 2190 |
| (...skipping 3904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6095 new MockExtensionProvider(service_, Manifest::EXTERNAL_PREF); | 6095 new MockExtensionProvider(service_, Manifest::EXTERNAL_PREF); |
| 6096 AddMockExternalProvider(provider); | 6096 AddMockExternalProvider(provider); |
| 6097 provider->UpdateOrAddExtension(updates_from_webstore, "1", crx_path); | 6097 provider->UpdateOrAddExtension(updates_from_webstore, "1", crx_path); |
| 6098 | 6098 |
| 6099 service_->CheckForExternalUpdates(); | 6099 service_->CheckForExternalUpdates(); |
| 6100 loop_.RunUntilIdle(); | 6100 loop_.RunUntilIdle(); |
| 6101 EXPECT_TRUE(extensions::HasExternalInstallError(service_)); | 6101 EXPECT_TRUE(extensions::HasExternalInstallError(service_)); |
| 6102 EXPECT_FALSE(extensions::HasExternalInstallBubble(service_)); | 6102 EXPECT_FALSE(extensions::HasExternalInstallBubble(service_)); |
| 6103 EXPECT_FALSE(service_->IsExtensionEnabled(updates_from_webstore)); | 6103 EXPECT_FALSE(service_->IsExtensionEnabled(updates_from_webstore)); |
| 6104 } | 6104 } |
| OLD | NEW |