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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 service->toolbar_model()->MoveBrowserAction( | 372 service->toolbar_model()->MoveBrowserAction( |
373 service->extensions()->at(size_before + 1), 1); | 373 service->extensions()->at(size_before + 1), 1); |
374 | 374 |
375 EXPECT_EQ(kTooltipC, GetBrowserActionsBar().GetTooltip(0)); | 375 EXPECT_EQ(kTooltipC, GetBrowserActionsBar().GetTooltip(0)); |
376 EXPECT_EQ(kTooltipB, GetBrowserActionsBar().GetTooltip(1)); | 376 EXPECT_EQ(kTooltipB, GetBrowserActionsBar().GetTooltip(1)); |
377 EXPECT_EQ(kTooltipA, GetBrowserActionsBar().GetTooltip(2)); | 377 EXPECT_EQ(kTooltipA, GetBrowserActionsBar().GetTooltip(2)); |
378 | 378 |
379 EXPECT_EQ(kTooltipC, incognito_bar.GetTooltip(0)); | 379 EXPECT_EQ(kTooltipC, incognito_bar.GetTooltip(0)); |
380 EXPECT_EQ(kTooltipA, incognito_bar.GetTooltip(1)); | 380 EXPECT_EQ(kTooltipA, incognito_bar.GetTooltip(1)); |
381 } | 381 } |
| 382 |
| 383 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, CloseBackgroundPage) { |
| 384 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII( |
| 385 "browser_action/close_background"))); |
| 386 const Extension* extension = GetSingleLoadedExtension(); |
| 387 |
| 388 // There is a background page and a browser action with no badge text. |
| 389 ExtensionProcessManager* manager = |
| 390 browser()->profile()->GetExtensionProcessManager(); |
| 391 ASSERT_TRUE(manager->GetBackgroundHostForExtension(extension)); |
| 392 ExtensionAction* action = extension->browser_action(); |
| 393 ASSERT_EQ("", action->GetBadgeText(ExtensionAction::kDefaultTabId)); |
| 394 |
| 395 // Click the browser action. |
| 396 browser()->profile()->GetExtensionService()->browser_event_router()-> |
| 397 BrowserActionExecuted( |
| 398 browser()->profile(), action->extension_id(), browser()); |
| 399 |
| 400 // It can take a moment for the background page to actually get destroyed |
| 401 // so we wait for the notification before checking that it's really gone |
| 402 // and the badge text has been set. |
| 403 ui_test_utils::WaitForNotification( |
| 404 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED); |
| 405 ASSERT_FALSE(manager->GetBackgroundHostForExtension(extension)); |
| 406 ASSERT_EQ("X", action->GetBadgeText(ExtensionAction::kDefaultTabId)); |
| 407 } |
OLD | NEW |