Commit 3632ff1b authored by Devlin Cronin's avatar Devlin Cronin Committed by Commit Bot

[Extensions UI] Add a suite for ExtensionActionViewController tests

Create a new class, ExtensionActionViewControllerUnitTest, which
subclasses ToolbarActionsBarTest, and add common utility methods in
that test class. Also move
ToolbarActionsBarTest::SetActionWantsToRunOnTab() to this new class,
as it was only used in these tests.

This reduces a lot of the repeated boilerplate code in the
ExtensionActionViewController related unittests, and will make
adjusting them for the ExtensionsMenu behavior easier.

No behavior change is expected.

Bug: 984654

Change-Id: Ic85832939187d04dd64ff0e9ef995cd86a8f5925
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1940881
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#722663}
parent c67465b8
......@@ -17,7 +17,6 @@
#include "chrome/browser/extensions/load_error_reporter.h"
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/browser/extensions/unpacked_installer.h"
#include "chrome/browser/sessions/session_tab_helper.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h"
......@@ -208,16 +207,6 @@ ToolbarActionsBarUnitTest::CreateAndAddExtension(const std::string& name,
return extension;
}
void ToolbarActionsBarUnitTest::SetActionWantsToRunOnTab(
ExtensionAction* action,
content::WebContents* web_contents,
bool wants_to_run) {
action->SetIsVisible(SessionTabHelper::IdForTab(web_contents).id(),
wants_to_run);
extensions::ExtensionActionAPI::Get(profile())->NotifyChange(
action, web_contents, profile());
}
testing::AssertionResult ToolbarActionsBarUnitTest::VerifyToolbarOrder(
const char* expected_names[],
size_t total_size,
......
......@@ -15,15 +15,10 @@
#include "chrome/test/base/browser_with_test_window_test.h"
#include "extensions/common/extension_builder.h"
class ExtensionAction;
class ScopedTestingLocalState;
class ToolbarActionsBar;
class ToolbarActionsModel;
namespace content {
class WebContents;
}
namespace extensions {
class Extension;
}
......@@ -52,11 +47,6 @@ class ToolbarActionsBarUnitTest : public BrowserWithTestWindowTest,
// Activates the tab at the given |index| in the tab strip model.
void ActivateTab(int index);
// Set whether or not the given |action| wants to run on the |web_contents|.
void SetActionWantsToRunOnTab(ExtensionAction* action,
content::WebContents* web_contents,
bool wants_to_run);
// Creates an extension with the given |name| and |action_type|, adds it to
// the associated extension service, and returns the created extension. (It's
// safe to ignore the returned value.)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment