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

Side by Side Diff: chrome/common/extensions/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
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/path_service.h" 7 #include "base/path_service.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 17 matching lines...) Expand all
28 class UnpackerTest : public testing::Test { 28 class UnpackerTest : public testing::Test {
29 public: 29 public:
30 virtual ~UnpackerTest() { 30 virtual ~UnpackerTest() {
31 LOG(WARNING) << "Deleting temp dir: " 31 LOG(WARNING) << "Deleting temp dir: "
32 << temp_dir_.path().LossyDisplayName(); 32 << temp_dir_.path().LossyDisplayName();
33 LOG(WARNING) << temp_dir_.Delete(); 33 LOG(WARNING) << temp_dir_.Delete();
34 } 34 }
35 35
36 virtual void SetUp() OVERRIDE { 36 virtual void SetUp() OVERRIDE {
37 testing::Test::SetUp(); 37 testing::Test::SetUp();
38 extensions::ManifestHandler::Register( 38 (new DefaultLocaleHandler)->Register();
39 keys::kDefaultLocale, 39 (new ThemeHandler)->Register();
40 make_linked_ptr(new extensions::DefaultLocaleHandler)); 40 }
41 extensions::ManifestHandler::Register( 41
42 keys::kTheme, 42 virtual void TearDown() OVERRIDE {
43 make_linked_ptr(new extensions::ThemeHandler)); 43 ManifestHandler::ClearRegistryForTesting();
44 } 44 }
45 45
46 void SetupUnpacker(const std::string& crx_name) { 46 void SetupUnpacker(const std::string& crx_name) {
47 base::FilePath original_path; 47 base::FilePath original_path;
48 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &original_path)); 48 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &original_path));
49 original_path = original_path.AppendASCII("extensions") 49 original_path = original_path.AppendASCII("extensions")
50 .AppendASCII("unpacker") 50 .AppendASCII("unpacker")
51 .AppendASCII(crx_name); 51 .AppendASCII(crx_name);
52 ASSERT_TRUE(file_util::PathExists(original_path)) << original_path.value(); 52 ASSERT_TRUE(file_util::PathExists(original_path)) << original_path.value();
53 53
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 SetupUnpacker("bad_image.crx"); 181 SetupUnpacker("bad_image.crx");
182 EXPECT_FALSE(unpacker_->Run()); 182 EXPECT_FALSE(unpacker_->Run());
183 EXPECT_TRUE(StartsWith(unpacker_->error_message(), 183 EXPECT_TRUE(StartsWith(unpacker_->error_message(),
184 ASCIIToUTF16(kExpected), 184 ASCIIToUTF16(kExpected),
185 false)) << "Expected prefix: \"" << kExpected 185 false)) << "Expected prefix: \"" << kExpected
186 << "\", actual error: \"" << unpacker_->error_message() 186 << "\", actual error: \"" << unpacker_->error_message()
187 << "\""; 187 << "\"";
188 } 188 }
189 189
190 } // namespace extensions 190 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698