| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/platform_thread.h" | 7 #include "base/platform_thread.h" |
| 8 #include "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
| 9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 SetupUnpacker("good_l10n.crx"); | 174 SetupUnpacker("good_l10n.crx"); |
| 175 ASSERT_TRUE(unpacker_->Run()); | 175 ASSERT_TRUE(unpacker_->Run()); |
| 176 ASSERT_TRUE(unpacker_->DumpImagesToFile()); | 176 ASSERT_TRUE(unpacker_->DumpImagesToFile()); |
| 177 ASSERT_TRUE(unpacker_->DumpMessageCatalogsToFile()); | 177 ASSERT_TRUE(unpacker_->DumpMessageCatalogsToFile()); |
| 178 | 178 |
| 179 // Check timestamp on _locales/en_US/messages.json. | 179 // Check timestamp on _locales/en_US/messages.json. |
| 180 FilePath messages_file; | 180 FilePath messages_file; |
| 181 messages_file = GetInstallPath().Append(Extension::kLocaleFolder) | 181 messages_file = GetInstallPath().Append(Extension::kLocaleFolder) |
| 182 .AppendASCII("en_US") | 182 .AppendASCII("en_US") |
| 183 .Append(Extension::kMessagesFilename); | 183 .Append(Extension::kMessagesFilename); |
| 184 file_util::FileInfo old_info; | 184 base::PlatformFileInfo old_info; |
| 185 EXPECT_TRUE(file_util::GetFileInfo(messages_file, &old_info)); | 185 EXPECT_TRUE(file_util::GetFileInfo(messages_file, &old_info)); |
| 186 | 186 |
| 187 // unpacker_->Run unpacks the extension. OnUnpackSucceeded overwrites some | 187 // unpacker_->Run unpacks the extension. OnUnpackSucceeded overwrites some |
| 188 // of the files. To force timestamp on overwriten files to be different we use | 188 // of the files. To force timestamp on overwriten files to be different we use |
| 189 // Sleep(1s). See comment on file_util::CountFilesCreatedAfter. | 189 // Sleep(1s). See comment on file_util::CountFilesCreatedAfter. |
| 190 PlatformThread::Sleep(1000); | 190 PlatformThread::Sleep(1000); |
| 191 OnUnpackSucceeded(); | 191 OnUnpackSucceeded(); |
| 192 | 192 |
| 193 // Check that there is newer _locales/en_US/messages.json file. | 193 // Check that there is newer _locales/en_US/messages.json file. |
| 194 file_util::FileInfo new_info; | 194 base::PlatformFileInfo new_info; |
| 195 EXPECT_TRUE(file_util::GetFileInfo(messages_file, &new_info)); | 195 EXPECT_TRUE(file_util::GetFileInfo(messages_file, &new_info)); |
| 196 | 196 |
| 197 EXPECT_TRUE(new_info.last_modified > old_info.last_modified); | 197 EXPECT_TRUE(new_info.last_modified > old_info.last_modified); |
| 198 | 198 |
| 199 ASSERT_TRUE(TempFilesRemoved()); | 199 ASSERT_TRUE(TempFilesRemoved()); |
| 200 } | 200 } |
| OLD | NEW |