chromium/chrome/browser/ui/browser_command_controller_unittest.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "chrome/browser/ui/browser_command_controller.h"

#include "base/command_line.h"
#include "base/memory/raw_ptr.h"
#include "base/test/run_until.h"
#include "base/test/scoped_feature_list.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/command_updater.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profiles_state.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_window_state.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/browser_with_test_window_test.h"
#include "chrome/test/base/test_browser_window.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/input/native_web_keyboard_event.h"
#include "components/performance_manager/public/features.h"
#include "components/policy/core/common/policy_pref_names.h"
#include "components/signin/public/base/signin_pref_names.h"
#include "content/public/test/web_contents_tester.h"
#include "extensions/buildflags/buildflags.h"
#include "ui/events/keycodes/dom/dom_code.h"
#include "ui/events/keycodes/keyboard_codes.h"

#if ((BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)) && \
     BUILDFLAG(ENABLE_EXTENSIONS))
#include "base/memory/scoped_refptr.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/test_extension_system.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension_builder.h"
#endif  // ((BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)) &&
        // BUILDFLAG(ENABLE_EXTENSIONS))

class BrowserCommandControllerTest : public BrowserWithTestWindowTest {};

TEST_F(BrowserCommandControllerTest, IsReservedCommandOrKey) {}

TEST_F(BrowserCommandControllerTest, IsReservedCommandOrKeyIsApp) {}

TEST_F(BrowserWithTestWindowTest, IncognitoCommands) {}

TEST_F(BrowserCommandControllerTest, AppFullScreen) {}

TEST_F(BrowserCommandControllerTest, AvatarAcceleratorEnabledOnDesktop) {}

TEST_F(BrowserCommandControllerTest, AvatarMenuAlwaysEnabledInIncognitoMode) {}

//////////////////////////////////////////////////////////////////////////////
class BrowserCommandControllerFullscreenTest;

// A test browser window that can toggle fullscreen state.
class FullscreenTestBrowserWindow : public TestBrowserWindow,
                                    ExclusiveAccessContext {};

// Test that uses FullscreenTestBrowserWindow for its window.
class BrowserCommandControllerFullscreenTest
    : public BrowserWithTestWindowTest {};

Profile* FullscreenTestBrowserWindow::GetProfile() {}

content::WebContents*
FullscreenTestBrowserWindow::GetWebContentsForExclusiveAccess() {}

TEST_F(BrowserCommandControllerFullscreenTest,
       UpdateCommandsForFullscreenMode) {}

// Ensure that the logic for enabling IDC_OPTIONS is consistent, regardless of
// the order of entering fullscreen and forced incognito modes. See
// http://crbug.com/694331.
TEST_F(BrowserWithTestWindowTest, OptionsConsistency) {}

TEST_F(BrowserCommandControllerTest,
       SavePageDisabledByDownloadRestrictionsPolicy) {}

TEST_F(BrowserCommandControllerTest,
       SavePageDisabledByAllowFileSelectionDialogsPolicy) {}

TEST_F(BrowserWithTestWindowTest, ClearBrowsingDataIsEnabledInIncognito) {}

class BrowserCommandControllerWithBookmarksTest
    : public BrowserCommandControllerTest {};

// Adding and removing background tabs should update the bookmark all tab
// command.
TEST_F(BrowserCommandControllerWithBookmarksTest,
       BookmarkAllTabsUpdatesOnTabStripChanges) {}

#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
class CreateShortcutBrowserCommandControllerTest
    : public BrowserCommandControllerTest {};

TEST_F(CreateShortcutBrowserCommandControllerTest, BrowserNoSiteNotEnabled) {}

TEST_F(CreateShortcutBrowserCommandControllerTest, DisabledForOTRProfile) {}

TEST_F(CreateShortcutBrowserCommandControllerTest, DisabledForGuestProfile) {}

TEST_F(CreateShortcutBrowserCommandControllerTest, DisabledForSystemProfile) {}

TEST_F(CreateShortcutBrowserCommandControllerTest, EnabledValidUrl) {}

TEST_F(CreateShortcutBrowserCommandControllerTest, InvalidSchemeDisabled) {}

#if BUILDFLAG(ENABLE_EXTENSIONS)
TEST_F(CreateShortcutBrowserCommandControllerTest,
       ChromeExtensionSchemeEnabled) {}
#endif  // BUILDFLAG(ENABLE_EXTENSIONS)

#endif  // BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)