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

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

Issue 12253022: Manifest handler for all keys background-related. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/menu_manager.cc ('k') | chrome/browser/extensions/startup_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/api/i18n/default_locale_handler.h"
15 #include "chrome/common/extensions/extension.h" 15 #include "chrome/common/extensions/extension.h"
16 #include "chrome/common/extensions/extension_manifest_constants.h" 16 #include "chrome/common/extensions/manifest_handler.h"
17 #include "chrome/common/extensions/unpacker.h" 17 #include "chrome/common/extensions/unpacker.h"
18 #include "content/public/test/test_browser_thread.h" 18 #include "content/public/test/test_browser_thread.h"
19 #include "testing/gmock/include/gmock/gmock.h" 19 #include "testing/gmock/include/gmock/gmock.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 #include "third_party/skia/include/core/SkBitmap.h" 21 #include "third_party/skia/include/core/SkBitmap.h"
22 22
23 using content::BrowserThread; 23 using content::BrowserThread;
24 using testing::_; 24 using testing::_;
25 using testing::Invoke; 25 using testing::Invoke;
26 26
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 class SandboxedUnpackerTest : public testing::Test { 60 class SandboxedUnpackerTest : public testing::Test {
61 public: 61 public:
62 virtual void SetUp() { 62 virtual void SetUp() {
63 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 63 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
64 ASSERT_TRUE(extensions_dir_.CreateUniqueTempDir()); 64 ASSERT_TRUE(extensions_dir_.CreateUniqueTempDir());
65 file_thread_.reset(new content::TestBrowserThread(BrowserThread::FILE, 65 file_thread_.reset(new content::TestBrowserThread(BrowserThread::FILE,
66 &loop_)); 66 &loop_));
67 // It will delete itself. 67 // It will delete itself.
68 client_ = new MockSandboxedUnpackerClient; 68 client_ = new MockSandboxedUnpackerClient;
69 client_->DelegateToFake(); 69 client_->DelegateToFake();
70 extensions::ManifestHandler::Register( 70 (new extensions::DefaultLocaleHandler)->Register();
71 extension_manifest_keys::kDefaultLocale,
72 make_linked_ptr(new extensions::DefaultLocaleHandler));
73 } 71 }
74 72
75 virtual void TearDown() { 73 virtual void TearDown() {
76 // Need to destruct SandboxedUnpacker before the message loop since 74 // Need to destruct SandboxedUnpacker before the message loop since
77 // it posts a task to it. 75 // it posts a task to it.
78 sandboxed_unpacker_ = NULL; 76 sandboxed_unpacker_ = NULL;
79 loop_.RunUntilIdle(); 77 loop_.RunUntilIdle();
78 ManifestHandler::ClearRegistryForTesting();
80 } 79 }
81 80
82 void SetupUnpacker(const std::string& crx_name) { 81 void SetupUnpacker(const std::string& crx_name) {
83 base::FilePath original_path; 82 base::FilePath original_path;
84 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &original_path)); 83 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &original_path));
85 original_path = original_path.AppendASCII("extensions") 84 original_path = original_path.AppendASCII("extensions")
86 .AppendASCII("unpacker") 85 .AppendASCII("unpacker")
87 .AppendASCII(crx_name); 86 .AppendASCII(crx_name);
88 ASSERT_TRUE(file_util::PathExists(original_path)) << original_path.value(); 87 ASSERT_TRUE(file_util::PathExists(original_path)) << original_path.value();
89 88
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // Check that there is newer _locales/en_US/messages.json file. 215 // Check that there is newer _locales/en_US/messages.json file.
217 base::PlatformFileInfo new_info; 216 base::PlatformFileInfo new_info;
218 EXPECT_TRUE(file_util::GetFileInfo(messages_file, &new_info)); 217 EXPECT_TRUE(file_util::GetFileInfo(messages_file, &new_info));
219 218
220 EXPECT_TRUE(new_info.last_modified > old_info.last_modified); 219 EXPECT_TRUE(new_info.last_modified > old_info.last_modified);
221 220
222 ASSERT_TRUE(TempFilesRemoved()); 221 ASSERT_TRUE(TempFilesRemoved());
223 } 222 }
224 223
225 } // namespace extensions 224 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/menu_manager.cc ('k') | chrome/browser/extensions/startup_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698