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

Side by Side Diff: chrome/browser/extensions/api/system_indicator/system_indicator_apitest.cc

Issue 15841013: Make miscellaneous_bindings and event_bindings Required as needed. Previously (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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/browser/extensions/api/system_indicator/system_indicator_manage r.h" 5 #include "chrome/browser/extensions/api/system_indicator/system_indicator_manage r.h"
6 #include "chrome/browser/extensions/api/system_indicator/system_indicator_manage r_factory.h" 6 #include "chrome/browser/extensions/api/system_indicator/system_indicator_manage r_factory.h"
7 #include "chrome/browser/extensions/extension_action.h" 7 #include "chrome/browser/extensions/extension_action.h"
8 #include "chrome/browser/extensions/extension_action_manager.h" 8 #include "chrome/browser/extensions/extension_action_manager.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "chrome/browser/extensions/extension_process_manager.h" 10 #include "chrome/browser/extensions/extension_process_manager.h"
(...skipping 11 matching lines...) Expand all
22 // for the event page to unload. 22 // for the event page to unload.
23 command_line->AppendSwitchASCII(switches::kEventPageIdleTime, "1"); 23 command_line->AppendSwitchASCII(switches::kEventPageIdleTime, "1");
24 command_line->AppendSwitchASCII(switches::kEventPageSuspendingTime, "1"); 24 command_line->AppendSwitchASCII(switches::kEventPageSuspendingTime, "1");
25 } 25 }
26 26
27 const extensions::Extension* LoadExtensionAndWait( 27 const extensions::Extension* LoadExtensionAndWait(
28 const std::string& test_name) { 28 const std::string& test_name) {
29 LazyBackgroundObserver page_complete; 29 LazyBackgroundObserver page_complete;
30 base::FilePath extdir = test_data_dir_.AppendASCII(test_name); 30 base::FilePath extdir = test_data_dir_.AppendASCII(test_name);
31 const extensions::Extension* extension = LoadExtension(extdir); 31 const extensions::Extension* extension = LoadExtension(extdir);
32 if (extension) 32 if (extension) {
33 LOG(INFO) << "waiting for page complete";
33 page_complete.Wait(); 34 page_complete.Wait();
35 LOG(INFO) << "done";
36 }
34 return extension; 37 return extension;
35 } 38 }
36 }; 39 };
37 40
38 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, SystemIndicator) { 41 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, SystemIndicator) {
39 // Only run this test on supported platforms. SystemIndicatorManagerFactory 42 // Only run this test on supported platforms. SystemIndicatorManagerFactory
40 // returns NULL on unsupported platforms. 43 // returns NULL on unsupported platforms.
41 extensions::SystemIndicatorManager* manager = 44 extensions::SystemIndicatorManager* manager =
42 extensions::SystemIndicatorManagerFactory::GetForProfile(profile()); 45 extensions::SystemIndicatorManagerFactory::GetForProfile(profile());
43 if (manager) { 46 if (manager) {
44 ASSERT_TRUE(RunExtensionTest("system_indicator/basics")) << message_; 47 ASSERT_TRUE(RunExtensionTest("system_indicator/basics")) << message_;
45 } 48 }
46 } 49 }
47 50
48 IN_PROC_BROWSER_TEST_F(SystemIndicatorApiTest, SystemIndicator) { 51 IN_PROC_BROWSER_TEST_F(SystemIndicatorApiTest, SystemIndicator) {
49 // Only run this test on supported platforms. SystemIndicatorManagerFactory 52 // Only run this test on supported platforms. SystemIndicatorManagerFactory
50 // returns NULL on unsupported platforms. 53 // returns NULL on unsupported platforms.
51 extensions::SystemIndicatorManager* manager = 54 extensions::SystemIndicatorManager* manager =
52 extensions::SystemIndicatorManagerFactory::GetForProfile(profile()); 55 extensions::SystemIndicatorManagerFactory::GetForProfile(profile());
53 if (manager) { 56 if (manager) {
54 ResultCatcher catcher; 57 ResultCatcher catcher;
55 58
56 const extensions::Extension* extension = 59 const extensions::Extension* extension =
57 LoadExtensionAndWait("system_indicator/unloaded"); 60 LoadExtensionAndWait("system_indicator/unloaded");
58 ASSERT_TRUE(extension) << message_; 61 ASSERT_TRUE(extension) << message_;
59 62
63 LOG(INFO) << "ran test";
64
60 // Lazy Background Page has been shut down. 65 // Lazy Background Page has been shut down.
61 ExtensionProcessManager* pm = 66 ExtensionProcessManager* pm =
62 extensions::ExtensionSystem::Get(profile())->process_manager(); 67 extensions::ExtensionSystem::Get(profile())->process_manager();
63 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_)); 68 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_));
64 69
65 EXPECT_TRUE(manager->SendClickEventToExtensionForTest(extension->id())); 70 EXPECT_TRUE(manager->SendClickEventToExtensionForTest(extension->id()));
66 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 71 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
67 } 72 }
68 } 73 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698