| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 base::FilePath original_path; | 91 base::FilePath original_path; |
| 92 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &original_path)); | 92 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &original_path)); |
| 93 original_path = original_path.AppendASCII("extensions") | 93 original_path = original_path.AppendASCII("extensions") |
| 94 .AppendASCII("zipfile_installer") | 94 .AppendASCII("zipfile_installer") |
| 95 .AppendASCII(zip_name); | 95 .AppendASCII(zip_name); |
| 96 ASSERT_TRUE(base::PathExists(original_path)) << original_path.value(); | 96 ASSERT_TRUE(base::PathExists(original_path)) << original_path.value(); |
| 97 | 97 |
| 98 zipfile_installer_ = ZipFileInstaller::Create(extension_service_); | 98 zipfile_installer_ = ZipFileInstaller::Create(extension_service_); |
| 99 | 99 |
| 100 base::ThreadTaskRunnerHandle::Get()->PostTask( | 100 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 101 FROM_HERE, | 101 FROM_HERE, base::BindOnce(&ZipFileInstaller::LoadFromZipFile, |
| 102 base::Bind(&ZipFileInstaller::LoadFromZipFile, | 102 zipfile_installer_, original_path)); |
| 103 zipfile_installer_, | |
| 104 original_path)); | |
| 105 observer_.WaitForInstall(); | 103 observer_.WaitForInstall(); |
| 106 } | 104 } |
| 107 | 105 |
| 108 protected: | 106 protected: |
| 109 scoped_refptr<ZipFileInstaller> zipfile_installer_; | 107 scoped_refptr<ZipFileInstaller> zipfile_installer_; |
| 110 | 108 |
| 111 std::unique_ptr<TestingProfile> profile_; | 109 std::unique_ptr<TestingProfile> profile_; |
| 112 ExtensionService* extension_service_; | 110 ExtensionService* extension_service_; |
| 113 | 111 |
| 114 content::TestBrowserThreadBundle browser_threads_; | 112 content::TestBrowserThreadBundle browser_threads_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 128 RunInstaller("good.zip"); | 126 RunInstaller("good.zip"); |
| 129 } | 127 } |
| 130 | 128 |
| 131 TEST_F(ZipFileInstallerTest, ZipWithPublicKey) { | 129 TEST_F(ZipFileInstallerTest, ZipWithPublicKey) { |
| 132 RunInstaller("public_key.zip"); | 130 RunInstaller("public_key.zip"); |
| 133 const char kIdForPublicKey[] = "ikppjpenhoddphklkpdfdfdabbakkpal"; | 131 const char kIdForPublicKey[] = "ikppjpenhoddphklkpdfdfdabbakkpal"; |
| 134 EXPECT_EQ(observer_.last_extension_installed, kIdForPublicKey); | 132 EXPECT_EQ(observer_.last_extension_installed, kIdForPublicKey); |
| 135 } | 133 } |
| 136 | 134 |
| 137 } // namespace extensions | 135 } // namespace extensions |
| OLD | NEW |