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

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

Issue 265032: Reland: HTML Pack Extension Dialog / Linux & Mac Packaging Support (Closed)
Patch Set: blarg Created 11 years, 2 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
« no previous file with comments | « chrome/browser/browser_init.cc ('k') | chrome/browser/extensions/extensions_ui.h » ('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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/json_reader.h" 10 #include "base/json_reader.h"
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 // class of validation that we do to the directory structure of the extension. 714 // class of validation that we do to the directory structure of the extension.
715 // We did not used to handle this correctly for installation. 715 // We did not used to handle this correctly for installation.
716 path = extensions_path.AppendASCII("bad_underscore.crx"); 716 path = extensions_path.AppendASCII("bad_underscore.crx");
717 InstallExtension(path, false); 717 InstallExtension(path, false);
718 ValidatePrefKeyCount(pref_count); 718 ValidatePrefKeyCount(pref_count);
719 719
720 // TODO(erikkay): add more tests for many of the failure cases. 720 // TODO(erikkay): add more tests for many of the failure cases.
721 // TODO(erikkay): add tests for upgrade cases. 721 // TODO(erikkay): add tests for upgrade cases.
722 } 722 }
723 723
724 #if defined(OS_WIN) // TODO(port)
725 // Test Packaging and installing an extension. 724 // Test Packaging and installing an extension.
726 // TODO(rafaelw): add more tests for failure cases. 725 // TODO(rafaelw): add more tests for failure cases.
727 TEST_F(ExtensionsServiceTest, PackExtension) { 726 TEST_F(ExtensionsServiceTest, PackExtension) {
728 InitializeEmptyExtensionsService(); 727 InitializeEmptyExtensionsService();
729 FilePath extensions_path; 728 FilePath extensions_path;
730 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &extensions_path)); 729 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &extensions_path));
731 extensions_path = extensions_path.AppendASCII("extensions"); 730 extensions_path = extensions_path.AppendASCII("extensions");
732 FilePath input_directory = extensions_path 731 FilePath input_directory = extensions_path
733 .AppendASCII("good") 732 .AppendASCII("good")
734 .AppendASCII("Extensions") 733 .AppendASCII("Extensions")
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 FilePath crx_path(output_directory.AppendASCII("ex1.crx")); 777 FilePath crx_path(output_directory.AppendASCII("ex1.crx"));
779 778
780 scoped_ptr<ExtensionCreator> creator(new ExtensionCreator()); 779 scoped_ptr<ExtensionCreator> creator(new ExtensionCreator());
781 ASSERT_TRUE(creator->Run(input_directory, crx_path, privkey_path, 780 ASSERT_TRUE(creator->Run(input_directory, crx_path, privkey_path,
782 FilePath())); 781 FilePath()));
783 782
784 InstallExtension(crx_path, true); 783 InstallExtension(crx_path, true);
785 784
786 file_util::Delete(crx_path, false); 785 file_util::Delete(crx_path, false);
787 } 786 }
788 #endif // defined(OS_WIN)
789 787
790 TEST_F(ExtensionsServiceTest, InstallTheme) { 788 TEST_F(ExtensionsServiceTest, InstallTheme) {
791 InitializeEmptyExtensionsService(); 789 InitializeEmptyExtensionsService();
792 FilePath extensions_path; 790 FilePath extensions_path;
793 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &extensions_path)); 791 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &extensions_path));
794 extensions_path = extensions_path.AppendASCII("extensions"); 792 extensions_path = extensions_path.AppendASCII("extensions");
795 793
796 // A theme. 794 // A theme.
797 FilePath path = extensions_path.AppendASCII("theme.crx"); 795 FilePath path = extensions_path.AppendASCII("theme.crx");
798 InstallExtension(path, true); 796 InstallExtension(path, true);
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 1555
1558 recorder.set_ready(false); 1556 recorder.set_ready(false);
1559 command_line.reset(new CommandLine(L"")); 1557 command_line.reset(new CommandLine(L""));
1560 service = new ExtensionsService(&profile, command_line.get(), 1558 service = new ExtensionsService(&profile, command_line.get(),
1561 profile.GetPrefs(), install_dir, &loop, &loop, false); 1559 profile.GetPrefs(), install_dir, &loop, &loop, false);
1562 EXPECT_FALSE(service->extensions_enabled()); 1560 EXPECT_FALSE(service->extensions_enabled());
1563 service->Init(); 1561 service->Init();
1564 loop.RunAllPending(); 1562 loop.RunAllPending();
1565 EXPECT_TRUE(recorder.ready()); 1563 EXPECT_TRUE(recorder.ready());
1566 } 1564 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_init.cc ('k') | chrome/browser/extensions/extensions_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698