#include <memory>
#include <utility>
#include "base/files/file_util.h"
#include "base/threading/thread_restrictions.h"
#include "base/values.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/extensions/commands/command_service.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/api/extension_action/action_info.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/test/test_extension_dir.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
const char kBasicBrowserActionKeybinding[] = …;
const char kBasicNamedKeybinding[] = …;
const char kBasicAlternateKeybinding[] = …;
const char kBasicNamedCommand[] = …;
constexpr char kAltNKeybinding[] = …;
constexpr char kAltZKeybinding[] = …;
constexpr char kExtensionId[] = …;
constexpr char kManifestTemplate[] = …;
std::string GetAnotherCommandPlatform() { … }
struct ManifestCommandTestParameters { … };
}
namespace extensions {
CommandServiceTest;
class CommandServiceMv3UpgradeTest
: public ExtensionApiTest,
public testing::WithParamInterface<ManifestCommandTestParameters> { … };
std::string CommandServiceMv3UpgradeTest::LoadExtensionMv2(
const char* suggested_keybinding) { … }
void CommandServiceMv3UpgradeTest::ReloadExtensionMv3(
const std::string& id,
const char* new_suggested_keybinding) { … }
void CommandServiceMv3UpgradeTest::InstallExtensionMv2(const std::string& id,
bool install_from_crx) { … }
void CommandServiceMv3UpgradeTest::UpdateExtensionMv3(
const std::string& id,
const char* mv3_extension_upgrade_folder) { … }
void CommandServiceMv3UpgradeTest::ChangeMv2CommandKeybinding(
const std::string& id,
const char* new_keybinding) { … }
void CommandServiceMv3UpgradeTest::CheckMv3UpgradeHasExpectedKeybindings(
const std::string& id,
const ui::KeyboardCode keyboard_code) { … }
bool CommandServiceMv3UpgradeTest::CommandHasAltPlusKeybinding(
const std::string& id,
const char* action_command_name,
const ui::KeyboardCode key) { … }
bool CommandServiceMv3UpgradeTest::CommandHasNoKeybinding(
const std::string& id,
const char* action_command_name) { … }
IN_PROC_BROWSER_TEST_P(CommandServiceMv3UpgradeTest,
ActionCommandUpgradesDuringReload) { … }
IN_PROC_BROWSER_TEST_P(CommandServiceMv3UpgradeTest,
ActionCommandUpgradesDuringWebstoreUpdate) { … }
IN_PROC_BROWSER_TEST_P(CommandServiceMv3UpgradeTest,
ActionCommandUpgradesDuringCrxUpdate) { … }
IN_PROC_BROWSER_TEST_P(CommandServiceMv3UpgradeTest,
UserModifiedActionCommandSurvivesReload) { … }
IN_PROC_BROWSER_TEST_P(CommandServiceMv3UpgradeTest,
UserModifiedCommandSurvivesWebstoreUpdate) { … }
IN_PROC_BROWSER_TEST_P(CommandServiceMv3UpgradeTest,
UserModifiedCommandSurvivesCrxUpdate) { … }
IN_PROC_BROWSER_TEST_P(CommandServiceMv3UpgradeTest,
SuggestedKeyModifiedActionCommandSurvivesReload) { … }
IN_PROC_BROWSER_TEST_P(CommandServiceMv3UpgradeTest,
SuggestedKeyModifiedActionCommandSurvivesWebstore) { … }
IN_PROC_BROWSER_TEST_P(CommandServiceMv3UpgradeTest,
SuggestedKeyModifiedActionCommandSurvivesCrx) { … }
IN_PROC_BROWSER_TEST_F(CommandServiceTest, RemoveShortcutSurvivesUpdate) { … }
IN_PROC_BROWSER_TEST_F(CommandServiceTest,
RemoveKeybindingPrefsShouldBePlatformSpecific) { … }
IN_PROC_BROWSER_TEST_F(CommandServiceTest,
GetExtensionActionCommandQueryAll) { … }
IN_PROC_BROWSER_TEST_F(CommandServiceTest,
GetExtensionActionCommandQueryActive) { … }
IN_PROC_BROWSER_TEST_F(CommandServiceTest,
GetNamedCommandsQueryAll) { … }
IN_PROC_BROWSER_TEST_F(CommandServiceTest, GetNamedCommandsQueryActive) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
}