| OLD | NEW |
| 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/browser_process.h" | 5 #include "chrome/browser/browser_process.h" |
| 6 #include "chrome/browser/extensions/extension_browsertest.h" | 6 #include "chrome/browser/extensions/extension_browsertest.h" |
| 7 #include "chrome/browser/extensions/extension_host.h" | 7 #include "chrome/browser/extensions/extension_host.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/browser/extensions/extension_system.h" | 9 #include "chrome/browser/extensions/extension_system.h" |
| 10 #include "chrome/browser/notifications/balloon.h" | 10 #include "chrome/browser/notifications/balloon.h" |
| 11 #include "chrome/browser/notifications/balloon_collection.h" | 11 #include "chrome/browser/notifications/balloon_collection.h" |
| 12 #include "chrome/browser/notifications/balloon_host.h" | 12 #include "chrome/browser/notifications/balloon_host.h" |
| 13 #include "chrome/browser/notifications/balloon_notification_ui_manager.h" | 13 #include "chrome/browser/notifications/balloon_notification_ui_manager.h" |
| 14 #include "chrome/browser/notifications/notification.h" | 14 #include "chrome/browser/notifications/notification.h" |
| 15 #include "chrome/browser/notifications/notification_delegate.h" | 15 #include "chrome/browser/notifications/notification_delegate.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/browser_commands.h" | 18 #include "chrome/browser/ui/browser_commands.h" |
| 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 20 #include "chrome/test/base/ui_test_utils.h" | 20 #include "chrome/test/base/ui_test_utils.h" |
| 21 #include "content/public/browser/navigation_controller.h" | 21 #include "content/public/browser/navigation_controller.h" |
| 22 #include "content/public/browser/render_process_host.h" | 22 #include "content/public/browser/render_process_host.h" |
| 23 #include "content/public/browser/render_view_host.h" | 23 #include "content/public/browser/render_view_host.h" |
| 24 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
| 25 #include "content/public/common/result_codes.h" | 25 #include "content/public/common/result_codes.h" |
| 26 #include "extensions/browser/extension_registry.h" | 26 #include "extensions/browser/extension_registry.h" |
| 27 #include "extensions/browser/process_manager.h" | 27 #include "extensions/browser/process_manager.h" |
| 28 #include "extensions/browser/process_map.h" |
| 28 #include "ui/message_center/message_center.h" | 29 #include "ui/message_center/message_center.h" |
| 29 #include "ui/message_center/message_center_switches.h" | 30 #include "ui/message_center/message_center_switches.h" |
| 30 #include "ui/message_center/message_center_util.h" | 31 #include "ui/message_center/message_center_util.h" |
| 31 #include "ui/message_center/notification_list.h" | 32 #include "ui/message_center/notification_list.h" |
| 32 | 33 |
| 33 using content::NavigationController; | 34 using content::NavigationController; |
| 34 using content::WebContents; | 35 using content::WebContents; |
| 35 using extensions::Extension; | 36 using extensions::Extension; |
| 36 using extensions::ExtensionRegistry; | 37 using extensions::ExtensionRegistry; |
| 37 | 38 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 extensions::ExtensionHost* extension_host = GetProcessManager()-> | 94 extensions::ExtensionHost* extension_host = GetProcessManager()-> |
| 94 GetBackgroundHostForExtension(extension_id); | 95 GetBackgroundHostForExtension(extension_id); |
| 95 ASSERT_TRUE(extension_host); | 96 ASSERT_TRUE(extension_host); |
| 96 extensions::ProcessManager::ViewSet all_views = | 97 extensions::ProcessManager::ViewSet all_views = |
| 97 GetProcessManager()->GetAllViews(); | 98 GetProcessManager()->GetAllViews(); |
| 98 extensions::ProcessManager::ViewSet::const_iterator it = | 99 extensions::ProcessManager::ViewSet::const_iterator it = |
| 99 all_views.find(extension_host->host_contents()->GetRenderViewHost()); | 100 all_views.find(extension_host->host_contents()->GetRenderViewHost()); |
| 100 ASSERT_FALSE(it == all_views.end()); | 101 ASSERT_FALSE(it == all_views.end()); |
| 101 ASSERT_TRUE(extension_host->IsRenderViewLive()); | 102 ASSERT_TRUE(extension_host->IsRenderViewLive()); |
| 102 extensions::ProcessMap* process_map = | 103 extensions::ProcessMap* process_map = |
| 103 browser()->profile()->GetExtensionService()->process_map(); | 104 extensions::ProcessMap::Get(browser()->profile()); |
| 104 ASSERT_TRUE(process_map->Contains( | 105 ASSERT_TRUE(process_map->Contains( |
| 105 extension_id, | 106 extension_id, |
| 106 extension_host->render_view_host()->GetProcess()->GetID())); | 107 extension_host->render_view_host()->GetProcess()->GetID())); |
| 107 } | 108 } |
| 108 | 109 |
| 109 void LoadTestExtension() { | 110 void LoadTestExtension() { |
| 110 ExtensionBrowserTest::SetUpInProcessBrowserTestFixture(); | 111 ExtensionBrowserTest::SetUpInProcessBrowserTestFixture(); |
| 111 const Extension* extension = LoadExtension( | 112 const Extension* extension = LoadExtension( |
| 112 test_data_dir_.AppendASCII("common").AppendASCII("background_page")); | 113 test_data_dir_.AppendASCII("common").AppendASCII("background_page")); |
| 113 ASSERT_TRUE(extension); | 114 ASSERT_TRUE(extension); |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 GetController())); | 577 GetController())); |
| 577 chrome::Reload(browser(), CURRENT_TAB); | 578 chrome::Reload(browser(), CURRENT_TAB); |
| 578 observer.Wait(); | 579 observer.Wait(); |
| 579 } | 580 } |
| 580 // Extension should now be loaded. | 581 // Extension should now be loaded. |
| 581 SCOPED_TRACE("after reloading the tab"); | 582 SCOPED_TRACE("after reloading the tab"); |
| 582 CheckExtensionConsistency(first_extension_id_); | 583 CheckExtensionConsistency(first_extension_id_); |
| 583 ASSERT_EQ(count_before + 1, GetEnabledExtensionCount()); | 584 ASSERT_EQ(count_before + 1, GetEnabledExtensionCount()); |
| 584 ASSERT_EQ(0U, CountBalloons()); | 585 ASSERT_EQ(0U, CountBalloons()); |
| 585 } | 586 } |
| OLD | NEW |