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

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

Issue 1120793007: [extensions] Replace MessageLoopProxy usage with ThreadTaskRunnerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Dependency over component module by removing file Created 5 years, 7 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/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/message_loop/message_loop.h"
10 #include "base/path_service.h" 9 #include "base/path_service.h"
11 #include "base/run_loop.h" 10 #include "base/run_loop.h"
12 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/thread_task_runner_handle.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "content/public/test/test_browser_thread_bundle.h" 14 #include "content/public/test/test_browser_thread_bundle.h"
15 #include "content/public/test/test_utils.h" 15 #include "content/public/test/test_utils.h"
16 #include "extensions/browser/extensions_test.h" 16 #include "extensions/browser/extensions_test.h"
17 #include "extensions/browser/sandboxed_unpacker.h" 17 #include "extensions/browser/sandboxed_unpacker.h"
18 #include "extensions/common/constants.h" 18 #include "extensions/common/constants.h"
19 #include "extensions/common/extension.h" 19 #include "extensions/common/extension.h"
20 #include "extensions/common/extension_paths.h" 20 #include "extensions/common/extension_paths.h"
21 #include "extensions/common/switches.h" 21 #include "extensions/common/switches.h"
22 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 void SetupUnpacker(const std::string& crx_name, 82 void SetupUnpacker(const std::string& crx_name,
83 const std::string& package_hash) { 83 const std::string& package_hash) {
84 base::FilePath original_path; 84 base::FilePath original_path;
85 ASSERT_TRUE(PathService::Get(extensions::DIR_TEST_DATA, &original_path)); 85 ASSERT_TRUE(PathService::Get(extensions::DIR_TEST_DATA, &original_path));
86 original_path = original_path.AppendASCII("unpacker").AppendASCII(crx_name); 86 original_path = original_path.AppendASCII("unpacker").AppendASCII(crx_name);
87 ASSERT_TRUE(base::PathExists(original_path)) << original_path.value(); 87 ASSERT_TRUE(base::PathExists(original_path)) << original_path.value();
88 88
89 sandboxed_unpacker_ = new SandboxedUnpacker( 89 sandboxed_unpacker_ = new SandboxedUnpacker(
90 extensions::CRXFileInfo(std::string(), original_path, package_hash), 90 extensions::CRXFileInfo(std::string(), original_path, package_hash),
91 Manifest::INTERNAL, Extension::NO_FLAGS, extensions_dir_.path(), 91 Manifest::INTERNAL, Extension::NO_FLAGS, extensions_dir_.path(),
92 base::MessageLoopProxy::current(), client_); 92 base::ThreadTaskRunnerHandle::Get(), client_);
93 93
94 base::MessageLoopProxy::current()->PostTask( 94 base::ThreadTaskRunnerHandle::Get()->PostTask(
95 FROM_HERE, 95 FROM_HERE,
96 base::Bind(&SandboxedUnpacker::Start, sandboxed_unpacker_.get())); 96 base::Bind(&SandboxedUnpacker::Start, sandboxed_unpacker_.get()));
97 client_->WaitForUnpack(); 97 client_->WaitForUnpack();
98 } 98 }
99 99
100 base::FilePath GetInstallPath() { 100 base::FilePath GetInstallPath() {
101 return client_->temp_dir().AppendASCII(kTempExtensionName); 101 return client_->temp_dir().AppendASCII(kTempExtensionName);
102 } 102 }
103 103
104 base::string16 GetInstallError() { return client_->unpack_err(); } 104 base::string16 GetInstallError() { return client_->unpack_err(); }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 EXPECT_EQ(base::string16(), GetInstallError()); 144 EXPECT_EQ(base::string16(), GetInstallError());
145 } 145 }
146 146
147 TEST_F(SandboxedUnpackerTest, SkipHashCheck) { 147 TEST_F(SandboxedUnpackerTest, SkipHashCheck) {
148 SetupUnpacker("good_l10n.crx", "badhash"); 148 SetupUnpacker("good_l10n.crx", "badhash");
149 // Check that there is no error message. 149 // Check that there is no error message.
150 EXPECT_EQ(base::string16(), GetInstallError()); 150 EXPECT_EQ(base::string16(), GetInstallError());
151 } 151 }
152 152
153 } // namespace extensions 153 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/declarative/declarative_api.cc ('k') | extensions/common/one_shot_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698