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

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

Issue 6125003: Make ExtensionBrowserEventRouter owned by ExtensionService.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 ExtensionAction* action = extension->browser_action(); 63 ExtensionAction* action = extension->browser_action();
64 ASSERT_EQ("Modified", action->GetTitle(ExtensionAction::kDefaultTabId)); 64 ASSERT_EQ("Modified", action->GetTitle(ExtensionAction::kDefaultTabId));
65 ASSERT_EQ("badge", action->GetBadgeText(ExtensionAction::kDefaultTabId)); 65 ASSERT_EQ("badge", action->GetBadgeText(ExtensionAction::kDefaultTabId));
66 ASSERT_EQ(SkColorSetARGB(255, 255, 255, 255), 66 ASSERT_EQ(SkColorSetARGB(255, 255, 255, 255),
67 action->GetBadgeBackgroundColor(ExtensionAction::kDefaultTabId)); 67 action->GetBadgeBackgroundColor(ExtensionAction::kDefaultTabId));
68 68
69 // Simulate the browser action being clicked. 69 // Simulate the browser action being clicked.
70 ui_test_utils::NavigateToURL(browser(), 70 ui_test_utils::NavigateToURL(browser(),
71 test_server()->GetURL("files/extensions/test_file.txt")); 71 test_server()->GetURL("files/extensions/test_file.txt"));
72 72
73 ExtensionBrowserEventRouter::GetInstance()->BrowserActionExecuted( 73 ExtensionService* service = browser()->profile()->GetExtensionService();
74 service->browser_event_router()->BrowserActionExecuted(
74 browser()->profile(), action->extension_id(), browser()); 75 browser()->profile(), action->extension_id(), browser());
75 76
76 // Verify the command worked. 77 // Verify the command worked.
77 TabContents* tab = browser()->GetSelectedTabContents(); 78 TabContents* tab = browser()->GetSelectedTabContents();
78 bool result = false; 79 bool result = false;
79 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( 80 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
80 tab->render_view_host(), L"", 81 tab->render_view_host(), L"",
81 L"setInterval(function(){" 82 L"setInterval(function(){"
82 L" if(document.body.bgColor == 'red'){" 83 L" if(document.body.bgColor == 'red'){"
83 L" window.domAutomationController.send(true)}}, 100)", 84 L" window.domAutomationController.send(true)}}, 100)",
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 service->toolbar_model()->MoveBrowserAction( 363 service->toolbar_model()->MoveBrowserAction(
363 service->extensions()->at(size_before + 1), 1); 364 service->extensions()->at(size_before + 1), 1);
364 365
365 EXPECT_EQ(kTooltipC, GetBrowserActionsBar().GetTooltip(0)); 366 EXPECT_EQ(kTooltipC, GetBrowserActionsBar().GetTooltip(0));
366 EXPECT_EQ(kTooltipB, GetBrowserActionsBar().GetTooltip(1)); 367 EXPECT_EQ(kTooltipB, GetBrowserActionsBar().GetTooltip(1));
367 EXPECT_EQ(kTooltipA, GetBrowserActionsBar().GetTooltip(2)); 368 EXPECT_EQ(kTooltipA, GetBrowserActionsBar().GetTooltip(2));
368 369
369 EXPECT_EQ(kTooltipC, incognito_bar.GetTooltip(0)); 370 EXPECT_EQ(kTooltipC, incognito_bar.GetTooltip(0));
370 EXPECT_EQ(kTooltipA, incognito_bar.GetTooltip(1)); 371 EXPECT_EQ(kTooltipA, incognito_bar.GetTooltip(1));
371 } 372 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698