#include "chrome/browser/ui/browser.h"
#include "base/memory/raw_ptr.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/ui/browser_command_controller.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/browser_with_test_window_test.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/test/base/testing_profile_manager.h"
#include "components/policy/core/common/policy_pref_names.h"
#include "components/zoom/zoom_controller.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/web_contents_tester.h"
#include "printing/buildflags/buildflags.h"
#include "third_party/skia/include/core/SkColor.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/login/users/fake_chrome_user_manager.h"
#include "components/session_manager/core/session_manager.h"
#include "components/user_manager/fake_user_manager.h"
#include "components/user_manager/scoped_user_manager.h"
#include "components/user_manager/user_names.h"
#endif
SiteInstance;
WebContents;
WebContentsTester;
#if BUILDFLAG(IS_CHROMEOS_ASH)
using session_manager::SessionState;
#endif
class BrowserUnitTest : public BrowserWithTestWindowTest { … };
TEST_F(BrowserUnitTest, ReloadCrashedTab) { … }
#if BUILDFLAG(IS_MAC)
#define MAYBE_SetBackgroundColorForNewTab …
#else
#define MAYBE_SetBackgroundColorForNewTab …
#endif
TEST_F(BrowserUnitTest, MAYBE_SetBackgroundColorForNewTab) { … }
#if BUILDFLAG(ENABLE_PRINTING)
TEST_F(BrowserUnitTest, DisablePrintOnCrashedTab) { … }
#endif
TEST_F(BrowserUnitTest, DisableZoomOnCrashedTab) { … }
TEST_F(BrowserUnitTest, CreateBrowserFailsIfProfileDisallowsBrowserWindows) { … }
TEST_F(BrowserUnitTest, CreateBrowserWithIncognitoModeDisabled) { … }
TEST_F(BrowserUnitTest, CreateBrowserWithIncognitoModeForced) { … }
TEST_F(BrowserUnitTest, CreateBrowserWithIncognitoModeEnabled) { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
TEST_F(BrowserUnitTest, CreateBrowserDuringKioskSplashScreen) {
auto* user_manager = new ash::FakeChromeUserManager();
user_manager::ScopedUserManager manager{
std::unique_ptr<user_manager::UserManager>(user_manager)};
const user_manager::User* user =
user_manager->AddKioskAppUser(AccountId::FromUserEmail("fake_user@test"));
user_manager->LoginUser(user->GetAccountId());
TestingProfile profile;
session_manager::SessionManager::Get()->SetSessionState(
SessionState::LOGIN_PRIMARY);
EXPECT_EQ(Browser::CreationStatus::kErrorLoadingKiosk,
Browser::GetCreationStatusForProfile(&profile));
Browser::CreateParams create_params = Browser::CreateParams(&profile, false);
std::unique_ptr<BrowserWindow> window = CreateBrowserWindow();
create_params.window = window.get();
session_manager::SessionManager::Get()->SetSessionState(SessionState::ACTIVE);
std::unique_ptr<Browser> test_browser(Browser::Create(create_params));
EXPECT_TRUE(test_browser);
}
#endif
class BrowserBookmarkBarTest : public BrowserWithTestWindowTest { … };
TEST_F(BrowserBookmarkBarTest, StateOnActiveTabChanged) { … }
TEST_F(BrowserUnitTest, CreateGuestSessionBrowser) { … }