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 "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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 ASSERT_EQ("badge", action->GetBadgeText(ExtensionAction::kDefaultTabId)); | 113 ASSERT_EQ("badge", action->GetBadgeText(ExtensionAction::kDefaultTabId)); |
114 ASSERT_EQ(SkColorSetARGB(255, 255, 255, 255), | 114 ASSERT_EQ(SkColorSetARGB(255, 255, 255, 255), |
115 action->GetBadgeBackgroundColor(ExtensionAction::kDefaultTabId)); | 115 action->GetBadgeBackgroundColor(ExtensionAction::kDefaultTabId)); |
116 | 116 |
117 // Simulate the browser action being clicked. | 117 // Simulate the browser action being clicked. |
118 ui_test_utils::NavigateToURL(browser(), | 118 ui_test_utils::NavigateToURL(browser(), |
119 test_server()->GetURL("files/extensions/test_file.txt")); | 119 test_server()->GetURL("files/extensions/test_file.txt")); |
120 | 120 |
121 ExtensionService* service = extensions::ExtensionSystem::Get( | 121 ExtensionService* service = extensions::ExtensionSystem::Get( |
122 browser()->profile())->extension_service(); | 122 browser()->profile())->extension_service(); |
123 service->toolbar_model()->ExecuteBrowserAction(extension, browser(), NULL); | 123 service->toolbar_model()->ExecuteBrowserAction( |
| 124 extension, browser(), NULL, true); |
124 | 125 |
125 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 126 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
126 } | 127 } |
127 | 128 |
128 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, DynamicBrowserAction) { | 129 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, DynamicBrowserAction) { |
129 ASSERT_TRUE(RunExtensionTest("browser_action/no_icon")) << message_; | 130 ASSERT_TRUE(RunExtensionTest("browser_action/no_icon")) << message_; |
130 const Extension* extension = GetSingleLoadedExtension(); | 131 const Extension* extension = GetSingleLoadedExtension(); |
131 ASSERT_TRUE(extension) << message_; | 132 ASSERT_TRUE(extension) << message_; |
132 | 133 |
133 #if defined (OS_MACOSX) | 134 #if defined (OS_MACOSX) |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 ASSERT_TRUE(manager->GetBackgroundHostForExtension(extension->id())); | 584 ASSERT_TRUE(manager->GetBackgroundHostForExtension(extension->id())); |
584 ExtensionAction* action = GetBrowserAction(*extension); | 585 ExtensionAction* action = GetBrowserAction(*extension); |
585 ASSERT_EQ("", action->GetBadgeText(ExtensionAction::kDefaultTabId)); | 586 ASSERT_EQ("", action->GetBadgeText(ExtensionAction::kDefaultTabId)); |
586 | 587 |
587 content::WindowedNotificationObserver host_destroyed_observer( | 588 content::WindowedNotificationObserver host_destroyed_observer( |
588 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, | 589 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
589 content::NotificationService::AllSources()); | 590 content::NotificationService::AllSources()); |
590 | 591 |
591 // Click the browser action. | 592 // Click the browser action. |
592 extensions::ExtensionSystem::Get(browser()->profile())->extension_service()-> | 593 extensions::ExtensionSystem::Get(browser()->profile())->extension_service()-> |
593 toolbar_model()->ExecuteBrowserAction(extension, browser(), NULL); | 594 toolbar_model()->ExecuteBrowserAction(extension, browser(), NULL, true); |
594 | 595 |
595 // It can take a moment for the background page to actually get destroyed | 596 // It can take a moment for the background page to actually get destroyed |
596 // so we wait for the notification before checking that it's really gone | 597 // so we wait for the notification before checking that it's really gone |
597 // and the badge text has been set. | 598 // and the badge text has been set. |
598 host_destroyed_observer.Wait(); | 599 host_destroyed_observer.Wait(); |
599 ASSERT_FALSE(manager->GetBackgroundHostForExtension(extension->id())); | 600 ASSERT_FALSE(manager->GetBackgroundHostForExtension(extension->id())); |
600 ASSERT_EQ("X", action->GetBadgeText(ExtensionAction::kDefaultTabId)); | 601 ASSERT_EQ("X", action->GetBadgeText(ExtensionAction::kDefaultTabId)); |
601 } | 602 } |
602 | 603 |
603 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, BadgeBackgroundColor) { | 604 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, BadgeBackgroundColor) { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 "backgroundColor);"; | 689 "backgroundColor);"; |
689 std::string result; | 690 std::string result; |
690 const std::string frame_xpath; | 691 const std::string frame_xpath; |
691 EXPECT_TRUE(content::ExecuteScriptInFrameAndExtractString( | 692 EXPECT_TRUE(content::ExecuteScriptInFrameAndExtractString( |
692 tab, frame_xpath, script, &result)); | 693 tab, frame_xpath, script, &result)); |
693 EXPECT_EQ(result, "red"); | 694 EXPECT_EQ(result, "red"); |
694 } | 695 } |
695 | 696 |
696 } // namespace | 697 } // namespace |
697 } // namespace extensions | 698 } // namespace extensions |
OLD | NEW |