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

Side by Side Diff: chrome/common/extensions/extension_file_util_unittest.cc

Issue 12042096: Move page action manifest parsing out of Extension; the first multi-key manifest handler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 "chrome/common/extensions/extension_file_util.h" 5 #include "chrome/common/extensions/extension_file_util.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/json/json_string_value_serializer.h" 9 #include "base/json/json_string_value_serializer.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/stringprintf.h" 11 #include "base/stringprintf.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/common/chrome_paths.h" 13 #include "chrome/common/chrome_paths.h"
14 #include "chrome/common/extensions/api/extension_action/browser_action_handler.h " 14 #include "chrome/common/extensions/api/extension_action/browser_action_handler.h "
15 #include "chrome/common/extensions/api/extension_action/page_action_handler.h"
15 #include "chrome/common/extensions/api/i18n/default_locale_handler.h" 16 #include "chrome/common/extensions/api/i18n/default_locale_handler.h"
16 #include "chrome/common/extensions/extension.h" 17 #include "chrome/common/extensions/extension.h"
17 #include "chrome/common/extensions/extension_manifest_constants.h" 18 #include "chrome/common/extensions/extension_manifest_constants.h"
18 #include "chrome/common/extensions/manifest.h" 19 #include "chrome/common/extensions/manifest.h"
19 #include "chrome/common/extensions/manifest_handler.h" 20 #include "chrome/common/extensions/manifest_handler.h"
20 #include "grit/generated_resources.h" 21 #include "grit/generated_resources.h"
21 #include "testing/gmock/include/gmock/gmock.h" 22 #include "testing/gmock/include/gmock/gmock.h"
22 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
23 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
24 25
25 using extensions::Extension; 26 using extensions::Extension;
26 using extensions::Manifest; 27 using extensions::Manifest;
27 28
28 namespace keys = extension_manifest_keys; 29 namespace keys = extension_manifest_keys;
29 30
30 class ExtensionFileUtilTest : public testing::Test { 31 class ExtensionFileUtilTest : public testing::Test {
31 protected: 32 protected:
32 virtual void SetUp() OVERRIDE { 33 virtual void SetUp() OVERRIDE {
33 testing::Test::SetUp(); 34 testing::Test::SetUp();
34 extensions::ManifestHandler::Register( 35 extensions::ManifestHandler::Register(
35 extension_manifest_keys::kBrowserAction, 36 keys::kBrowserAction,
36 make_linked_ptr(new extensions::BrowserActionHandler)); 37 make_linked_ptr(new extensions::BrowserActionHandler));
38 linked_ptr<extensions::PageActionHandler> page_action_handler(
39 new extensions::PageActionHandler);
40 extensions::ManifestHandler::Register(keys::kPageAction,
41 page_action_handler);
42 extensions::ManifestHandler::Register(keys::kPageActions,
43 page_action_handler);
37 extensions::ManifestHandler::Register( 44 extensions::ManifestHandler::Register(
38 keys::kDefaultLocale, 45 keys::kDefaultLocale,
39 make_linked_ptr(new extensions::DefaultLocaleHandler)); 46 make_linked_ptr(new extensions::DefaultLocaleHandler));
40 } 47 }
41 }; 48 };
42 49
43 #if defined(OS_WIN) 50 #if defined(OS_WIN)
44 // http://crbug.com/106381 51 // http://crbug.com/106381
45 #define InstallUninstallGarbageCollect DISABLED_InstallUninstallGarbageCollect 52 #define InstallUninstallGarbageCollect DISABLED_InstallUninstallGarbageCollect
46 #endif 53 #endif
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 scoped_refptr<Extension> extension3(extension_file_util::LoadExtension( 614 scoped_refptr<Extension> extension3(extension_file_util::LoadExtension(
608 ext_dir, Manifest::LOAD, Extension::NO_FLAGS, &error)); 615 ext_dir, Manifest::LOAD, Extension::NO_FLAGS, &error));
609 ASSERT_TRUE(extension3 == NULL); 616 ASSERT_TRUE(extension3 == NULL);
610 ASSERT_STREQ("Could not load icon 'icon.png' for page action.", 617 ASSERT_STREQ("Could not load icon 'icon.png' for page action.",
611 error.c_str()); 618 error.c_str());
612 } 619 }
613 620
614 // TODO(aa): More tests as motivation allows. Maybe steal some from 621 // TODO(aa): More tests as motivation allows. Maybe steal some from
615 // ExtensionService? Many of them could probably be tested here without the 622 // ExtensionService? Many of them could probably be tested here without the
616 // MessageLoop shenanigans. 623 // MessageLoop shenanigans.
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_file_util.cc ('k') | chrome/common/extensions/extension_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698