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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/prefs/pref_service.h" | 6 #include "base/prefs/pref_service.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/devtools/devtools_window.h" | 10 #include "chrome/browser/devtools/devtools_window.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
31 #include "chrome/common/url_constants.h" | 31 #include "chrome/common/url_constants.h" |
32 #include "chrome/test/base/interactive_test_utils.h" | 32 #include "chrome/test/base/interactive_test_utils.h" |
33 #include "chrome/test/base/ui_test_utils.h" | 33 #include "chrome/test/base/ui_test_utils.h" |
34 #include "content/public/browser/native_web_keyboard_event.h" | 34 #include "content/public/browser/native_web_keyboard_event.h" |
35 #include "content/public/browser/notification_service.h" | 35 #include "content/public/browser/notification_service.h" |
36 #include "content/public/browser/web_contents.h" | 36 #include "content/public/browser/web_contents.h" |
37 #include "content/public/common/url_constants.h" | 37 #include "content/public/common/url_constants.h" |
38 #include "content/public/test/browser_test_utils.h" | 38 #include "content/public/test/browser_test_utils.h" |
39 #include "content/test/net/url_request_mock_http_job.h" | 39 #include "content/test/net/url_request_mock_http_job.h" |
40 #include "extensions/browser/extension_registry.h" | |
41 #include "extensions/common/constants.h" | 40 #include "extensions/common/constants.h" |
42 #include "net/base/net_util.h" | 41 #include "net/base/net_util.h" |
43 #include "testing/gtest/include/gtest/gtest.h" | 42 #include "testing/gtest/include/gtest/gtest.h" |
44 #include "ui/base/hit_test.h" | 43 #include "ui/base/hit_test.h" |
45 #include "ui/events/event_utils.h" | 44 #include "ui/events/event_utils.h" |
46 #include "ui/gfx/screen.h" | 45 #include "ui/gfx/screen.h" |
47 | 46 |
48 using content::WebContents; | 47 using content::WebContents; |
49 | 48 |
50 class PanelBrowserTest : public BasePanelBrowserTest { | 49 class PanelBrowserTest : public BasePanelBrowserTest { |
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1412 Panel* panel_other = CreatePanel(extension_app_name_other); | 1411 Panel* panel_other = CreatePanel(extension_app_name_other); |
1413 | 1412 |
1414 content::WindowedNotificationObserver signal( | 1413 content::WindowedNotificationObserver signal( |
1415 chrome::NOTIFICATION_PANEL_CLOSED, | 1414 chrome::NOTIFICATION_PANEL_CLOSED, |
1416 content::Source<Panel>(panel)); | 1415 content::Source<Panel>(panel)); |
1417 content::WindowedNotificationObserver signal1( | 1416 content::WindowedNotificationObserver signal1( |
1418 chrome::NOTIFICATION_PANEL_CLOSED, | 1417 chrome::NOTIFICATION_PANEL_CLOSED, |
1419 content::Source<Panel>(panel1)); | 1418 content::Source<Panel>(panel1)); |
1420 | 1419 |
1421 // Send unload notification on the first extension. | 1420 // Send unload notification on the first extension. |
1422 extensions::ExtensionRegistry* registry = | 1421 extensions::UnloadedExtensionInfo details( |
1423 extensions::ExtensionRegistry::Get(browser()->profile()); | 1422 extension.get(), extensions::UnloadedExtensionInfo::REASON_UNINSTALL); |
1424 registry->RemoveEnabled(extension->id()); | 1423 content::NotificationService::current()->Notify( |
1425 registry->TriggerOnUnloaded( | 1424 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
1426 extension.get(), | 1425 content::Source<Profile>(browser()->profile()), |
1427 extensions::UnloadedExtensionInfo::REASON_UNINSTALL); | 1426 content::Details<extensions::UnloadedExtensionInfo>(&details)); |
1428 | 1427 |
1429 // Wait for the panels opened by the first extension to close. | 1428 // Wait for the panels opened by the first extension to close. |
1430 signal.Wait(); | 1429 signal.Wait(); |
1431 signal1.Wait(); | 1430 signal1.Wait(); |
1432 | 1431 |
1433 // Verify that the panel that's left is the panel from the second extension. | 1432 // Verify that the panel that's left is the panel from the second extension. |
1434 EXPECT_EQ(panel_other, panel_manager->panels()[0]); | 1433 EXPECT_EQ(panel_other, panel_manager->panels()[0]); |
1435 panel_other->Close(); | 1434 panel_other->Close(); |
1436 } | 1435 } |
1437 | 1436 |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1774 #else | 1773 #else |
1775 #define MAYBE_FocusChangeEventOnMinimize FocusChangeEventOnMinimize | 1774 #define MAYBE_FocusChangeEventOnMinimize FocusChangeEventOnMinimize |
1776 #endif | 1775 #endif |
1777 IN_PROC_BROWSER_TEST_F(PanelExtensionApiTest, | 1776 IN_PROC_BROWSER_TEST_F(PanelExtensionApiTest, |
1778 MAYBE_FocusChangeEventOnMinimize) { | 1777 MAYBE_FocusChangeEventOnMinimize) { |
1779 // This is needed so the subsequently created panels can be activated. | 1778 // This is needed so the subsequently created panels can be activated. |
1780 // On a Mac, it transforms background-only test process into foreground one. | 1779 // On a Mac, it transforms background-only test process into foreground one. |
1781 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 1780 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
1782 ASSERT_TRUE(RunExtensionTest("panels/focus_change_on_minimize")) << message_; | 1781 ASSERT_TRUE(RunExtensionTest("panels/focus_change_on_minimize")) << message_; |
1783 } | 1782 } |
OLD | NEW |