Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: chrome/browser/extensions/sandboxed_unpacker_unittest.cc

Issue 12025010: Move default_locale out of Extension class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: extension_service_unittest fixed Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/browser/extensions/sandboxed_unpacker.h" 12 #include "chrome/browser/extensions/sandboxed_unpacker.h"
13 #include "chrome/common/chrome_paths.h" 13 #include "chrome/common/chrome_paths.h"
14 #include "chrome/common/extensions/api/i18n/default_locale_handler.h"
14 #include "chrome/common/extensions/extension.h" 15 #include "chrome/common/extensions/extension.h"
15 #include "chrome/common/extensions/extension_manifest_constants.h" 16 #include "chrome/common/extensions/extension_manifest_constants.h"
16 #include "chrome/common/extensions/unpacker.h" 17 #include "chrome/common/extensions/unpacker.h"
17 #include "content/public/test/test_browser_thread.h" 18 #include "content/public/test/test_browser_thread.h"
18 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
20 #include "third_party/skia/include/core/SkBitmap.h" 21 #include "third_party/skia/include/core/SkBitmap.h"
21 22
22 namespace errors = extension_manifest_errors;
23 namespace keys = extension_manifest_keys;
24
25 using content::BrowserThread; 23 using content::BrowserThread;
26 using testing::_; 24 using testing::_;
27 using testing::Invoke; 25 using testing::Invoke;
28 26
29 namespace { 27 namespace {
30 28
31 void OnUnpackSuccess(const FilePath& temp_dir, 29 void OnUnpackSuccess(const FilePath& temp_dir,
32 const FilePath& extension_root, 30 const FilePath& extension_root,
33 const DictionaryValue* original_manifest, 31 const DictionaryValue* original_manifest,
34 const extensions::Extension* extension) { 32 const extensions::Extension* extension) {
(...skipping 27 matching lines...) Expand all
62 class SandboxedUnpackerTest : public testing::Test { 60 class SandboxedUnpackerTest : public testing::Test {
63 public: 61 public:
64 virtual void SetUp() { 62 virtual void SetUp() {
65 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 63 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
66 ASSERT_TRUE(extensions_dir_.CreateUniqueTempDir()); 64 ASSERT_TRUE(extensions_dir_.CreateUniqueTempDir());
67 file_thread_.reset(new content::TestBrowserThread(BrowserThread::FILE, 65 file_thread_.reset(new content::TestBrowserThread(BrowserThread::FILE,
68 &loop_)); 66 &loop_));
69 // It will delete itself. 67 // It will delete itself.
70 client_ = new MockSandboxedUnpackerClient; 68 client_ = new MockSandboxedUnpackerClient;
71 client_->DelegateToFake(); 69 client_->DelegateToFake();
70 extensions::ManifestHandler::Register(
71 extension_manifest_keys::kDefaultLocale,
72 new extensions::DefaultLocaleHandler);
72 } 73 }
73 74
74 virtual void TearDown() { 75 virtual void TearDown() {
75 // Need to destruct SandboxedUnpacker before the message loop since 76 // Need to destruct SandboxedUnpacker before the message loop since
76 // it posts a task to it. 77 // it posts a task to it.
77 sandboxed_unpacker_ = NULL; 78 sandboxed_unpacker_ = NULL;
78 loop_.RunUntilIdle(); 79 loop_.RunUntilIdle();
79 } 80 }
80 81
81 void SetupUnpacker(const std::string& crx_name) { 82 void SetupUnpacker(const std::string& crx_name) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 // Check that there is newer _locales/en_US/messages.json file. 216 // Check that there is newer _locales/en_US/messages.json file.
216 base::PlatformFileInfo new_info; 217 base::PlatformFileInfo new_info;
217 EXPECT_TRUE(file_util::GetFileInfo(messages_file, &new_info)); 218 EXPECT_TRUE(file_util::GetFileInfo(messages_file, &new_info));
218 219
219 EXPECT_TRUE(new_info.last_modified > old_info.last_modified); 220 EXPECT_TRUE(new_info.last_modified > old_info.last_modified);
220 221
221 ASSERT_TRUE(TempFilesRemoved()); 222 ASSERT_TRUE(TempFilesRemoved());
222 } 223 }
223 224
224 } // namespace extensions 225 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service_unittest.cc ('k') | chrome/browser/extensions/user_script_master.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698