| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 virtual ~BrowserActionApiTest() {} | 31 virtual ~BrowserActionApiTest() {} |
| 32 | 32 |
| 33 protected: | 33 protected: |
| 34 BrowserActionTestUtil GetBrowserActionsBar() { | 34 BrowserActionTestUtil GetBrowserActionsBar() { |
| 35 return BrowserActionTestUtil(browser()); | 35 return BrowserActionTestUtil(browser()); |
| 36 } | 36 } |
| 37 | 37 |
| 38 bool OpenPopup(int index) { | 38 bool OpenPopup(int index) { |
| 39 ResultCatcher catcher; | 39 ResultCatcher catcher; |
| 40 ui_test_utils::WindowedNotificationObserver popup_observer( | 40 ui_test_utils::WindowedNotificationObserver popup_observer( |
| 41 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 41 chrome::NOTIFICATION_EXTENSION_POPUP_VIEW_READY, |
| 42 content::NotificationService::AllSources()); | 42 content::NotificationService::AllSources()); |
| 43 GetBrowserActionsBar().Press(index); | 43 GetBrowserActionsBar().Press(index); |
| 44 popup_observer.Wait(); | 44 popup_observer.Wait(); |
| 45 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 45 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 46 return GetBrowserActionsBar().HasPopup(); | 46 return GetBrowserActionsBar().HasPopup(); |
| 47 } | 47 } |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, Basic) { | 50 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, Basic) { |
| 51 ASSERT_TRUE(test_server()->Start()); | 51 ASSERT_TRUE(test_server()->Start()); |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 BrowserActionExecuted( | 405 BrowserActionExecuted( |
| 406 browser()->profile(), action->extension_id(), browser()); | 406 browser()->profile(), action->extension_id(), browser()); |
| 407 | 407 |
| 408 // It can take a moment for the background page to actually get destroyed | 408 // It can take a moment for the background page to actually get destroyed |
| 409 // so we wait for the notification before checking that it's really gone | 409 // so we wait for the notification before checking that it's really gone |
| 410 // and the badge text has been set. | 410 // and the badge text has been set. |
| 411 host_destroyed_observer.Wait(); | 411 host_destroyed_observer.Wait(); |
| 412 ASSERT_FALSE(manager->GetBackgroundHostForExtension(extension->id())); | 412 ASSERT_FALSE(manager->GetBackgroundHostForExtension(extension->id())); |
| 413 ASSERT_EQ("X", action->GetBadgeText(ExtensionAction::kDefaultTabId)); | 413 ASSERT_EQ("X", action->GetBadgeText(ExtensionAction::kDefaultTabId)); |
| 414 } | 414 } |
| OLD | NEW |