Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(483)

Side by Side Diff: chrome/browser/extensions/api/extension_action/browser_action_apitest.cc

Issue 425303002: Move extension notifications to extensions/browser/notification_types.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (extension-notifications) rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/extensions/browser_action_test_util.h" 6 #include "chrome/browser/extensions/browser_action_test_util.h"
9 #include "chrome/browser/extensions/extension_action.h" 7 #include "chrome/browser/extensions/extension_action.h"
10 #include "chrome/browser/extensions/extension_action_icon_factory.h" 8 #include "chrome/browser/extensions/extension_action_icon_factory.h"
11 #include "chrome/browser/extensions/extension_action_manager.h" 9 #include "chrome/browser/extensions/extension_action_manager.h"
12 #include "chrome/browser/extensions/extension_apitest.h" 10 #include "chrome/browser/extensions/extension_apitest.h"
13 #include "chrome/browser/extensions/extension_service.h" 11 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/extensions/extension_tab_util.h" 12 #include "chrome/browser/extensions/extension_tab_util.h"
15 #include "chrome/browser/extensions/extension_toolbar_model.h" 13 #include "chrome/browser/extensions/extension_toolbar_model.h"
16 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/browser_commands.h" 16 #include "chrome/browser/ui/browser_commands.h"
19 #include "chrome/browser/ui/browser_window.h" 17 #include "chrome/browser/ui/browser_window.h"
20 #include "chrome/browser/ui/tabs/tab_strip_model.h" 18 #include "chrome/browser/ui/tabs/tab_strip_model.h"
21 #include "chrome/common/url_constants.h" 19 #include "chrome/common/url_constants.h"
22 #include "chrome/test/base/ui_test_utils.h" 20 #include "chrome/test/base/ui_test_utils.h"
23 #include "content/public/browser/notification_service.h" 21 #include "content/public/browser/notification_service.h"
24 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
25 #include "content/public/test/browser_test_utils.h" 23 #include "content/public/test/browser_test_utils.h"
26 #include "extensions/browser/extension_system.h" 24 #include "extensions/browser/extension_system.h"
25 #include "extensions/browser/notification_types.h"
27 #include "extensions/common/feature_switch.h" 26 #include "extensions/common/feature_switch.h"
28 #include "grit/theme_resources.h" 27 #include "grit/theme_resources.h"
29 #include "ui/base/resource/resource_bundle.h" 28 #include "ui/base/resource/resource_bundle.h"
30 #include "ui/gfx/image/image_skia.h" 29 #include "ui/gfx/image/image_skia.h"
31 #include "ui/gfx/image/image_skia_operations.h" 30 #include "ui/gfx/image/image_skia_operations.h"
32 #include "ui/gfx/rect.h" 31 #include "ui/gfx/rect.h"
33 #include "ui/gfx/size.h" 32 #include "ui/gfx/size.h"
34 #include "ui/gfx/skia_util.h" 33 #include "ui/gfx/skia_util.h"
35 34
36 using content::WebContents; 35 using content::WebContents;
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 const Extension* extension = GetSingleLoadedExtension(); 611 const Extension* extension = GetSingleLoadedExtension();
613 612
614 // There is a background page and a browser action with no badge text. 613 // There is a background page and a browser action with no badge text.
615 extensions::ProcessManager* manager = 614 extensions::ProcessManager* manager =
616 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); 615 extensions::ExtensionSystem::Get(browser()->profile())->process_manager();
617 ASSERT_TRUE(manager->GetBackgroundHostForExtension(extension->id())); 616 ASSERT_TRUE(manager->GetBackgroundHostForExtension(extension->id()));
618 ExtensionAction* action = GetBrowserAction(*extension); 617 ExtensionAction* action = GetBrowserAction(*extension);
619 ASSERT_EQ("", action->GetBadgeText(ExtensionAction::kDefaultTabId)); 618 ASSERT_EQ("", action->GetBadgeText(ExtensionAction::kDefaultTabId));
620 619
621 content::WindowedNotificationObserver host_destroyed_observer( 620 content::WindowedNotificationObserver host_destroyed_observer(
622 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, 621 extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED,
623 content::NotificationService::AllSources()); 622 content::NotificationService::AllSources());
624 623
625 // Click the browser action. 624 // Click the browser action.
626 ExtensionToolbarModel* toolbar_model = ExtensionToolbarModel::Get( 625 ExtensionToolbarModel* toolbar_model = ExtensionToolbarModel::Get(
627 browser()->profile()); 626 browser()->profile());
628 toolbar_model->ExecuteBrowserAction(extension, browser(), NULL, true); 627 toolbar_model->ExecuteBrowserAction(extension, browser(), NULL, true);
629 628
630 // It can take a moment for the background page to actually get destroyed 629 // It can take a moment for the background page to actually get destroyed
631 // so we wait for the notification before checking that it's really gone 630 // so we wait for the notification before checking that it's really gone
632 // and the badge text has been set. 631 // and the badge text has been set.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 const std::string script = 720 const std::string script =
722 "window.domAutomationController.send(document.body.style." 721 "window.domAutomationController.send(document.body.style."
723 "backgroundColor);"; 722 "backgroundColor);";
724 std::string result; 723 std::string result;
725 EXPECT_TRUE(content::ExecuteScriptAndExtractString(tab, script, &result)); 724 EXPECT_TRUE(content::ExecuteScriptAndExtractString(tab, script, &result));
726 EXPECT_EQ(result, "red"); 725 EXPECT_EQ(result, "red");
727 } 726 }
728 727
729 } // namespace 728 } // namespace
730 } // namespace extensions 729 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698