summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc
diff options
context:
space:
mode:
authorcira@chromium.org <cira@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-16 21:11:06 +0000
committercira@chromium.org <cira@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-16 21:11:06 +0000
commitc6d474f8e04b08306349ea514d529b8f25ffd4b2 (patch)
tree756833e85392a8b487cf3ee3cefd0d81ab8c51fa /chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc
parent538a1ac2bc5ad7f171e15642edb4e8c1dd34348d (diff)
downloadchromium_src-c6d474f8e04b08306349ea514d529b8f25ffd4b2.zip
chromium_src-c6d474f8e04b08306349ea514d529b8f25ffd4b2.tar.gz
chromium_src-c6d474f8e04b08306349ea514d529b8f25ffd4b2.tar.bz2
Localizing manifest for installed or unpacked extensions.
1. Use _MSG_ format for manifest fields instead of hard-coded names. 2. Localize manifest during installation procedure -> save localized version to prefs. 3. Add current_locale field to manifest so we can detect when chrome locale changes and re-localize manifest. 4. Adds prefs method to MigratePrefs&Write to disk. 5. General refactor of extension_file_util wrt l10n code. 6. Don't localize themes (we can revert this by adding default_locale and current_locale keys to allowed keys for theme section). BUG=27360 Review URL: http://codereview.chromium.org/434015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34749 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc')
-rw-r--r--chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc b/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc
index 5613c9e..f48da5d 100644
--- a/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc
+++ b/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc
@@ -4,6 +4,7 @@
#include "base/file_util.h"
#include "base/path_service.h"
+#include "base/platform_thread.h"
#include "base/ref_counted.h"
#include "base/scoped_temp_dir.h"
#include "base/string_util.h"
@@ -51,7 +52,7 @@ class MockSandboxedExtensionUnpackerClient
class SandboxedExtensionUnpackerTest : public testing::Test {
public:
- virtual void SetUp () {
+ virtual void SetUp() {
// It will delete itself.
client_ = new MockSandboxedExtensionUnpackerClient;
client_->DelegateToFake();
@@ -143,16 +144,24 @@ TEST_F(SandboxedExtensionUnpackerTest, WithCatalogsSuccess) {
ASSERT_TRUE(unpacker_->Run());
ASSERT_TRUE(unpacker_->DumpImagesToFile());
- // Delete _locales/en_US/messages.json.
+ // Check timestamp on _locales/en_US/messages.json.
FilePath messages_file;
messages_file = GetInstallPath()
.AppendASCII(Extension::kLocaleFolder)
.AppendASCII("en_US")
.AppendASCII(Extension::kMessagesFilename);
- EXPECT_TRUE(file_util::Delete(messages_file, false));
+ file_util::FileInfo old_info;
+ EXPECT_TRUE(file_util::GetFileInfo(messages_file, &old_info));
+ // unpacker_->Run unpacks the extension. OnUnpackSucceeded overwrites some
+ // of the files. To force timestamp on overwriten files to be different we use
+ // Sleep(1s). See comment on file_util::CountFilesCreatedAfter.
+ PlatformThread::Sleep(1000);
OnUnpackSucceeded();
- // Check that there is _locales/en_US/messages.json file.
- EXPECT_TRUE(file_util::PathExists(messages_file));
+ // Check that there is newer _locales/en_US/messages.json file.
+ file_util::FileInfo new_info;
+ EXPECT_TRUE(file_util::GetFileInfo(messages_file, &new_info));
+
+ EXPECT_TRUE(new_info.last_modified > old_info.last_modified);
}