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

Unified Diff: chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc

Issue 6297003: Fail gracefully if profile Temp dir can not be accessed. (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: Address rev comments. Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/sandboxed_extension_unpacker.cc ('k') | chrome/common/chrome_paths.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc
diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc b/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc
index 6246a6fd45ab57b25af4e9875c4baa971165707c..ecc521c388eafe81439a3506a8d836241bb82a2e 100644
--- a/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc
+++ b/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -22,12 +22,16 @@ namespace keys = extension_manifest_keys;
using testing::_;
using testing::Invoke;
+namespace {
+
void OnUnpackSuccess(const FilePath& temp_dir,
const FilePath& extension_root,
const Extension* extension) {
// Don't delete temp_dir here, we need to do some post op checking.
}
+} // namespace
+
class MockSandboxedExtensionUnpackerClient
: public SandboxedExtensionUnpackerClient {
public:
@@ -78,7 +82,7 @@ class SandboxedExtensionUnpackerTest : public testing::Test {
// a temp folder to play in.
ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &install_dir_));
install_dir_ =
- install_dir_.AppendASCII("sandboxed_extension_unpacker_test");
+ install_dir_.AppendASCII("sandboxed_extension_unpacker_test");
file_util::Delete(install_dir_, true);
file_util::CreateDirectory(install_dir_);
@@ -89,14 +93,14 @@ class SandboxedExtensionUnpackerTest : public testing::Test {
unpacker_.reset(new ExtensionUnpacker(crx_path));
-
// Build a temp area where the extension will be unpacked.
ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &temp_dir_));
temp_dir_ = temp_dir_.AppendASCII("sandboxed_extension_unpacker_test_Temp");
- file_util::CreateDirectory(temp_dir_);
+ ASSERT_TRUE(file_util::CreateDirectory(temp_dir_));
sandboxed_unpacker_ =
- new SandboxedExtensionUnpacker(crx_path, temp_dir_, NULL, client_);
+ new SandboxedExtensionUnpacker(crx_path, NULL, client_);
+
// Hack since SandboxedExtensionUnpacker gets its background thread id from
// the Start call, but we don't call it here.
sandboxed_unpacker_->thread_identifier_ = BrowserThread::FILE;
@@ -159,6 +163,7 @@ class SandboxedExtensionUnpackerTest : public testing::Test {
TEST_F(SandboxedExtensionUnpackerTest, NoCatalogsSuccess) {
EXPECT_CALL(*client_, OnUnpackSuccess(_, _, _));
+ EXPECT_CALL(*client_, OnUnpackFailure(_)).Times(0);
SetupUnpacker("no_l10n.crx");
ASSERT_TRUE(unpacker_->Run());
@@ -180,6 +185,7 @@ TEST_F(SandboxedExtensionUnpackerTest, NoCatalogsSuccess) {
TEST_F(SandboxedExtensionUnpackerTest, WithCatalogsSuccess) {
EXPECT_CALL(*client_, OnUnpackSuccess(_, _, _));
+ EXPECT_CALL(*client_, OnUnpackFailure(_)).Times(0);
SetupUnpacker("good_l10n.crx");
ASSERT_TRUE(unpacker_->Run());
« no previous file with comments | « chrome/browser/extensions/sandboxed_extension_unpacker.cc ('k') | chrome/common/chrome_paths.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698