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 "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 return (items_not_removed == 0); | 152 return (items_not_removed == 0); |
153 } | 153 } |
154 | 154 |
155 protected: | 155 protected: |
156 base::ScopedTempDir temp_dir_; | 156 base::ScopedTempDir temp_dir_; |
157 base::ScopedTempDir extensions_dir_; | 157 base::ScopedTempDir extensions_dir_; |
158 base::FilePath temp_path_; | 158 base::FilePath temp_path_; |
159 MockSandboxedUnpackerClient* client_; | 159 MockSandboxedUnpackerClient* client_; |
160 scoped_ptr<Unpacker> unpacker_; | 160 scoped_ptr<Unpacker> unpacker_; |
161 scoped_refptr<SandboxedUnpacker> sandboxed_unpacker_; | 161 scoped_refptr<SandboxedUnpacker> sandboxed_unpacker_; |
162 MessageLoop loop_; | 162 base::MessageLoop loop_; |
163 scoped_ptr<content::TestBrowserThread> file_thread_; | 163 scoped_ptr<content::TestBrowserThread> file_thread_; |
164 }; | 164 }; |
165 | 165 |
166 TEST_F(SandboxedUnpackerTest, NoCatalogsSuccess) { | 166 TEST_F(SandboxedUnpackerTest, NoCatalogsSuccess) { |
167 EXPECT_CALL(*client_, OnUnpackSuccess(_, _, _, _)); | 167 EXPECT_CALL(*client_, OnUnpackSuccess(_, _, _, _)); |
168 EXPECT_CALL(*client_, OnUnpackFailure(_)).Times(0); | 168 EXPECT_CALL(*client_, OnUnpackFailure(_)).Times(0); |
169 | 169 |
170 SetupUnpacker("no_l10n.crx"); | 170 SetupUnpacker("no_l10n.crx"); |
171 ASSERT_TRUE(unpacker_->Run()); | 171 ASSERT_TRUE(unpacker_->Run()); |
172 ASSERT_TRUE(unpacker_->DumpImagesToFile()); | 172 ASSERT_TRUE(unpacker_->DumpImagesToFile()); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 // Check that there is newer _locales/en_US/messages.json file. | 212 // Check that there is newer _locales/en_US/messages.json file. |
213 base::PlatformFileInfo new_info; | 213 base::PlatformFileInfo new_info; |
214 EXPECT_TRUE(file_util::GetFileInfo(messages_file, &new_info)); | 214 EXPECT_TRUE(file_util::GetFileInfo(messages_file, &new_info)); |
215 | 215 |
216 EXPECT_TRUE(new_info.last_modified > old_info.last_modified); | 216 EXPECT_TRUE(new_info.last_modified > old_info.last_modified); |
217 | 217 |
218 ASSERT_TRUE(TempFilesRemoved()); | 218 ASSERT_TRUE(TempFilesRemoved()); |
219 } | 219 } |
220 | 220 |
221 } // namespace extensions | 221 } // namespace extensions |
OLD | NEW |