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

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

Issue 12494028: Move Requirements out of Extension Class (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 9 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 "chrome/browser/extensions/extension_browsertest.h" 5 #include "chrome/browser/extensions/extension_browsertest.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 15 matching lines...) Expand all
26 #include "chrome/browser/profiles/profile.h" 26 #include "chrome/browser/profiles/profile.h"
27 #include "chrome/browser/profiles/profile_manager.h" 27 #include "chrome/browser/profiles/profile_manager.h"
28 #include "chrome/browser/ui/browser.h" 28 #include "chrome/browser/ui/browser.h"
29 #include "chrome/browser/ui/browser_window.h" 29 #include "chrome/browser/ui/browser_window.h"
30 #include "chrome/browser/ui/omnibox/location_bar.h" 30 #include "chrome/browser/ui/omnibox/location_bar.h"
31 #include "chrome/browser/ui/tabs/tab_strip_model.h" 31 #include "chrome/browser/ui/tabs/tab_strip_model.h"
32 #include "chrome/common/chrome_notification_types.h" 32 #include "chrome/common/chrome_notification_types.h"
33 #include "chrome/common/chrome_paths.h" 33 #include "chrome/common/chrome_paths.h"
34 #include "chrome/common/chrome_switches.h" 34 #include "chrome/common/chrome_switches.h"
35 #include "chrome/common/chrome_version_info.h" 35 #include "chrome/common/chrome_version_info.h"
36 #include "chrome/common/extensions/api/requirements/requirements_handler.h"
36 #include "chrome/common/extensions/extension_manifest_constants.h" 37 #include "chrome/common/extensions/extension_manifest_constants.h"
37 #include "chrome/common/extensions/extension_set.h" 38 #include "chrome/common/extensions/extension_set.h"
38 #include "chrome/common/extensions/manifest_handler.h" 39 #include "chrome/common/extensions/manifest_handler.h"
39 #include "chrome/test/base/ui_test_utils.h" 40 #include "chrome/test/base/ui_test_utils.h"
40 #include "content/public/browser/navigation_controller.h" 41 #include "content/public/browser/navigation_controller.h"
41 #include "content/public/browser/navigation_entry.h" 42 #include "content/public/browser/navigation_entry.h"
42 #include "content/public/browser/notification_registrar.h" 43 #include "content/public/browser/notification_registrar.h"
43 #include "content/public/browser/notification_service.h" 44 #include "content/public/browser/notification_service.h"
44 #include "content/public/browser/render_view_host.h" 45 #include "content/public/browser/render_view_host.h"
45 #include "content/public/test/browser_test_utils.h" 46 #include "content/public/test/browser_test_utils.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // ExtensionService and then the real profile with one, as we do when 102 // ExtensionService and then the real profile with one, as we do when
102 // running on chromeos. 103 // running on chromeos.
103 command_line->AppendSwitchASCII(switches::kLoginUser, 104 command_line->AppendSwitchASCII(switches::kLoginUser,
104 "TestUser@gmail.com"); 105 "TestUser@gmail.com");
105 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); 106 command_line->AppendSwitchASCII(switches::kLoginProfile, "user");
106 #endif 107 #endif
107 } 108 }
108 109
109 void ExtensionBrowserTest::SetUpOnMainThread() { 110 void ExtensionBrowserTest::SetUpOnMainThread() {
110 InProcessBrowserTest::SetUpOnMainThread(); 111 InProcessBrowserTest::SetUpOnMainThread();
112 // We need to register tbe Requirements handler here because many tests like
113 // this install extensions with CrxInstallers, which need access to
114 // requirements for verification.
115 (new extensions::RequirementsHandler)->Register();
116 }
117
118 void ExtensionBrowserTest::CleanUpOnMainThread() {
119 extensions::ManifestHandler::ClearRegistryForTesting();
120 InProcessBrowserTest::SetUpOnMainThread();
Yoyo Zhou 2013/03/20 22:41:36 Should be CleanUp (but I don't think you need this
111 } 121 }
112 122
113 const Extension* ExtensionBrowserTest::LoadExtensionWithFlags( 123 const Extension* ExtensionBrowserTest::LoadExtensionWithFlags(
114 const base::FilePath& path, int flags) { 124 const base::FilePath& path, int flags) {
115 ExtensionService* service = extensions::ExtensionSystem::Get( 125 ExtensionService* service = extensions::ExtensionSystem::Get(
116 profile())->extension_service(); 126 profile())->extension_service();
117 { 127 {
118 content::NotificationRegistrar registrar; 128 content::NotificationRegistrar registrar;
119 registrar.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 129 registrar.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
120 content::NotificationService::AllSources()); 130 content::NotificationService::AllSources());
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 case content::NOTIFICATION_LOAD_STOP: 736 case content::NOTIFICATION_LOAD_STOP:
727 VLOG(1) << "Got LOAD_STOP notification."; 737 VLOG(1) << "Got LOAD_STOP notification.";
728 MessageLoopForUI::current()->Quit(); 738 MessageLoopForUI::current()->Quit();
729 break; 739 break;
730 740
731 default: 741 default:
732 NOTREACHED(); 742 NOTREACHED();
733 break; 743 break;
734 } 744 }
735 } 745 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698