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

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

Issue 6793008: Replacing base::DIR_TEMP with ScopedTempDir when appropriate. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Needed to rebase; patch didn't apply cleanly to save_package_unittest. Created 9 years, 8 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/extensions/extension_service_unittest.h" 5 #include "chrome/browser/extensions/extension_service_unittest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/json/json_reader.h" 14 #include "base/json/json_reader.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/scoped_temp_dir.h"
16 #include "base/message_loop.h" 17 #include "base/message_loop.h"
17 #include "base/path_service.h" 18 #include "base/path_service.h"
18 #include "base/stl_util-inl.h" 19 #include "base/stl_util-inl.h"
19 #include "base/string16.h" 20 #include "base/string16.h"
20 #include "base/string_number_conversions.h" 21 #include "base/string_number_conversions.h"
21 #include "base/string_util.h" 22 #include "base/string_util.h"
22 #include "base/task.h" 23 #include "base/task.h"
23 #include "base/utf_string_conversions.h" 24 #include "base/utf_string_conversions.h"
24 #include "base/version.h" 25 #include "base/version.h"
25 #include "chrome/browser/extensions/crx_installer.h" 26 #include "chrome/browser/extensions/crx_installer.h"
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 } 513 }
513 514
514 protected: 515 protected:
515 void TestExternalProvider(MockExtensionProvider* provider, 516 void TestExternalProvider(MockExtensionProvider* provider,
516 Extension::Location location); 517 Extension::Location location);
517 518
518 void PackAndInstallExtension(const FilePath& dir_path, 519 void PackAndInstallExtension(const FilePath& dir_path,
519 const FilePath& pem_path, 520 const FilePath& pem_path,
520 bool should_succeed) { 521 bool should_succeed) {
521 FilePath crx_path; 522 FilePath crx_path;
522 ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &crx_path)); 523 ScopedTempDir temp_dir;
523 crx_path = crx_path.AppendASCII("temp.crx"); 524 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
525 crx_path = temp_dir_.path().AppendASCII("temp.crx");
524 526
525 // Use the existing pem key, if provided. 527 // Use the existing pem key, if provided.
526 FilePath pem_output_path; 528 FilePath pem_output_path;
527 if (pem_path.value().empty()) { 529 if (pem_path.value().empty()) {
528 pem_output_path = crx_path.DirName().AppendASCII("temp.pem"); 530 pem_output_path = crx_path.DirName().AppendASCII("temp.pem");
529 ASSERT_TRUE(file_util::Delete(pem_output_path, false)); 531 ASSERT_TRUE(file_util::Delete(pem_output_path, false));
530 } else { 532 } else {
531 ASSERT_TRUE(file_util::PathExists(pem_path)); 533 ASSERT_TRUE(file_util::PathExists(pem_path));
532 } 534 }
533 535
(...skipping 2993 matching lines...) Expand 10 before | Expand all | Expand 10 after
3527 // Component extensions shouldn't get recourded in the prefs. 3529 // Component extensions shouldn't get recourded in the prefs.
3528 ValidatePrefKeyCount(0); 3530 ValidatePrefKeyCount(0);
3529 3531
3530 // Reload all extensions, and make sure it comes back. 3532 // Reload all extensions, and make sure it comes back.
3531 std::string extension_id = service_->extensions()->at(0)->id(); 3533 std::string extension_id = service_->extensions()->at(0)->id();
3532 loaded_.clear(); 3534 loaded_.clear();
3533 service_->ReloadExtensions(); 3535 service_->ReloadExtensions();
3534 ASSERT_EQ(1u, service_->extensions()->size()); 3536 ASSERT_EQ(1u, service_->extensions()->size());
3535 EXPECT_EQ(extension_id, service_->extensions()->at(0)->id()); 3537 EXPECT_EQ(extension_id, service_->extensions()->at(0)->id());
3536 } 3538 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_browsertest.cc ('k') | chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698