| 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 "extensions/browser/sandboxed_unpacker.h" | 5 #include "extensions/browser/sandboxed_unpacker.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 } | 38 } |
| 39 | 39 |
| 40 base::FilePath temp_dir() const { return temp_dir_; } | 40 base::FilePath temp_dir() const { return temp_dir_; } |
| 41 base::string16 unpack_err() const { return error_; } | 41 base::string16 unpack_err() const { return error_; } |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 ~MockSandboxedUnpackerClient() override {} | 44 ~MockSandboxedUnpackerClient() override {} |
| 45 | 45 |
| 46 void OnUnpackSuccess(const base::FilePath& temp_dir, | 46 void OnUnpackSuccess(const base::FilePath& temp_dir, |
| 47 const base::FilePath& extension_root, | 47 const base::FilePath& extension_root, |
| 48 const base::DictionaryValue* original_manifest, | 48 std::unique_ptr<base::DictionaryValue> original_manifest, |
| 49 const Extension* extension, | 49 const Extension* extension, |
| 50 const SkBitmap& install_icon) override { | 50 const SkBitmap& install_icon) override { |
| 51 temp_dir_ = temp_dir; | 51 temp_dir_ = temp_dir; |
| 52 quit_closure_.Run(); | 52 quit_closure_.Run(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void OnUnpackFailure(const CrxInstallError& error) override { | 55 void OnUnpackFailure(const CrxInstallError& error) override { |
| 56 error_ = error.message(); | 56 error_ = error.message(); |
| 57 quit_closure_.Run(); | 57 quit_closure_.Run(); |
| 58 } | 58 } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 EXPECT_EQ(base::string16(), GetInstallError()); | 183 EXPECT_EQ(base::string16(), GetInstallError()); |
| 184 } | 184 } |
| 185 | 185 |
| 186 TEST_F(SandboxedUnpackerTest, SkipHashCheck) { | 186 TEST_F(SandboxedUnpackerTest, SkipHashCheck) { |
| 187 SetupUnpacker("good_l10n.crx", "badhash"); | 187 SetupUnpacker("good_l10n.crx", "badhash"); |
| 188 // Check that there is no error message. | 188 // Check that there is no error message. |
| 189 EXPECT_EQ(base::string16(), GetInstallError()); | 189 EXPECT_EQ(base::string16(), GetInstallError()); |
| 190 } | 190 } |
| 191 | 191 |
| 192 } // namespace extensions | 192 } // namespace extensions |
| OLD | NEW |