1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660
|
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_UPDATER_TEST_INTEGRATION_TESTS_IMPL_H_
#define CHROME_UPDATER_TEST_INTEGRATION_TESTS_IMPL_H_
#include <map>
#include <optional>
#include <set>
#include <string>
#include <vector>
#include "base/containers/flat_map.h"
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/process/process_iterator.h"
#include "base/values.h"
#include "base/version.h"
#include "build/build_config.h"
#include "chrome/updater/external_constants.h"
#include "chrome/updater/test/server.h"
#include "chrome/updater/update_service.h"
#include "chrome/updater/updater_version.h"
#if BUILDFLAG(IS_WIN)
#include <windows.h>
#include <wrl/client.h>
#include "chrome/updater/app/server/win/updater_legacy_idl.h"
#endif
class GURL;
namespace base {
class CommandLine;
class TimeDelta;
class Value;
} // namespace base
namespace updater {
enum class UpdaterScope;
struct RegistrationRequest;
} // namespace updater
namespace wireless_android_enterprise_devicemanagement {
class OmahaSettingsClientProto;
} // namespace wireless_android_enterprise_devicemanagement
namespace updater::test {
enum class AppBundleWebCreateMode {
kCreateApp = 0,
kCreateInstalledApp = 1,
};
struct AppUpdateExpectation {
AppUpdateExpectation(const std::string& args,
const std::string& app_id,
const base::Version& from_version,
const base::Version& to_version,
bool is_install,
bool should_update,
bool allow_rollback,
const std::string& target_version_prefix,
const std::string& target_channel,
const base::FilePath& crx_relative_path,
bool always_serve_crx = false,
const UpdateService::ErrorCategory error_category =
UpdateService::ErrorCategory::kService,
const int error_code = static_cast<int>(
UpdateService::Result::kUpdateCanceled),
const int event_type = /*EVENT_UPDATE_COMPLETE=*/3,
const std::string& custom_app_response = {},
const std::string& response_status = {});
AppUpdateExpectation(const AppUpdateExpectation&);
~AppUpdateExpectation();
const std::string args;
const std::string app_id;
const base::Version from_version;
const base::Version to_version;
const bool is_install;
const bool should_update;
const bool allow_rollback;
const std::string target_version_prefix;
const std::string target_channel;
const base::FilePath crx_relative_path;
const bool always_serve_crx;
const UpdateService::ErrorCategory error_category;
const int error_code;
const int event_type;
const std::string custom_app_response;
const std::string response_status;
};
struct TestUpdaterVersion {
base::FilePath updater_setup_path;
base::Version version;
};
// Returns the path to the updater installer program (in the build output
// directory). This is typically the updater setup, or the updater itself for
// the platforms where a setup program is not provided.
base::FilePath GetSetupExecutablePath();
// Returns the non-duplicate, unique names for processes which may be running
// during unit tests.
std::set<base::FilePath::StringType> GetTestProcessNames();
#if BUILDFLAG(IS_WIN)
// Filters to processes that match the current and older updater versions.
class VersionProcessFilter : public base::ProcessFilter {
public:
VersionProcessFilter();
~VersionProcessFilter() override;
bool Includes(const base::ProcessEntry& entry) const override;
private:
const std::vector<base::Version> versions_;
};
#endif // BUILDFLAG(IS_WIN)
// Ensures test processes are not running after the function is called.
void CleanProcesses();
// Verifies that test processes are not running.
void ExpectCleanProcesses();
// Prints the provided file to stdout.
void PrintFile(const base::FilePath& file);
// Returns all the `updater*.log` files found in the temp directory for the
// current test scope.
std::vector<base::FilePath> GetUpdaterLogFilesInTmp();
// Prints the updater.log file to stdout.
void PrintLog(UpdaterScope scope);
// Removes traces of the updater from the system. It is best to run this at the
// start of each test in case a previous crash or timeout on the machine running
// the test left the updater in an installed or partially installed state.
void Clean(UpdaterScope scope);
// Expects that the system is in a clean state, i.e. no updater is installed and
// no traces of an updater exist. Should be run at the start and end of each
// test.
void ExpectClean(UpdaterScope scope);
// The overinstall timeout for `EnterTestMode`. Different for windows/mac/linux.
base::TimeDelta GetOverinstallTimeoutForEnterTestMode();
// Places the updater into test mode (redirect server URLs and disable CUP).
void EnterTestMode(const GURL& update_url,
const GURL& crash_upload_url,
const GURL& app_logo_url,
const GURL& event_logging_url,
base::TimeDelta idle_timeout,
base::TimeDelta server_keep_alive_time,
base::TimeDelta ceca_connection_timeout,
std::optional<EventLoggingPermissionProvider>
event_logging_permission_provider);
// Takes the updater our of the test mode by deleting the external constants
// JSON file.
void ExitTestMode(UpdaterScope scope);
// Sets the dict policies that are surfaced via external constants.
void SetDictPolicies(const base::Value::Dict& values);
// Sets platform policies. Platform policy is group policy on Windows, and
// Managed Preferences on macOS.
void SetPlatformPolicies(const base::Value::Dict& values);
// Sets whether the machine is in managed state.
void SetMachineManaged(bool is_managed_device);
// Expects to find no crashes. If there are any crashes, causes the test to
// fail. Copies any crashes found to the isolate directory. In system scope,
// this checks for crashes from both the system and the user updaters.
void ExpectNoCrashes(UpdaterScope scope);
// Copies the logs to a location where they can be retrieved by ResultDB.
void CopyLog(const base::FilePath& src_dir, const std::string& infix);
// Expects that the updater is installed on the system.
void ExpectInstalled(UpdaterScope scope);
// Installs the updater.
void Install(UpdaterScope scope, const base::Value::List& switches);
// Installs the updater and an app via the command line.
void InstallUpdaterAndApp(UpdaterScope scope,
const std::string& app_id,
bool is_silent_install,
const std::string& tag,
const std::string& child_window_text_to_find,
bool always_launch_cmd,
bool verify_app_logo_loaded,
bool expect_success,
bool wait_for_the_installer,
int expected_exit_code,
const base::Value::List& additional_switches,
const base::FilePath& updater_path);
// Expects that the updater is installed on the system and the specified
// version is active.
void ExpectVersionActive(UpdaterScope scope, const std::string& version);
void ExpectVersionNotActive(UpdaterScope scope, const std::string& version);
// Uninstalls the updater. If the updater was installed during the test, it
// should be uninstalled before the end of the test to avoid having an actual
// live updater on the machine that ran the test.
void Uninstall(UpdaterScope scope);
// Runs the wake client and wait for it to exit. Assert that it exits with
// `exit_code`. The server should exit a few seconds after.
void RunWake(UpdaterScope scope, int exit_code, const base::Version& version);
// Runs the wake-all client and wait for it to exit. Assert that it exits with
// kErrorOk. The server should exit a few seconds after.
void RunWakeAll(UpdaterScope scope);
// As RunWake, but runs the wake client for whatever version of the server is
// active, rather than kUpdaterVersion.
void RunWakeActive(UpdaterScope scope, int exit_code);
// Starts an updater process with switch `--crash-me`.
void RunCrashMe(UpdaterScope scope);
// Runs the server and waits for it to exit. Assert that it exits with
// `exit_code`.
void RunServer(UpdaterScope scope, int exit_code, bool internal);
// Invokes the active instance's UpdateService::Update (via RPC) for an app.
void Update(UpdaterScope scope,
const std::string& app_id,
const std::string& install_data_index);
// Invokes the active instance's UpdateService::CheckForUpdate (via RPC) for an
// app.
void CheckForUpdate(UpdaterScope scope, const std::string& app_id);
// Invokes UpdateService::CheckForUpdate (via RPC) for the opposite scope of the
// given `scope` and `app_id`.
void ExpectCheckForUpdateOppositeScopeFails(UpdaterScope scope,
const std::string& app_id);
// Invokes the active instance's UpdateService::UpdateAll (via RPC).
void UpdateAll(UpdaterScope scope);
// Invokes the active instance's UpdateService::Install (via RPC) for an
// app.
void InstallAppViaService(UpdaterScope scope,
const std::string& app_id,
const base::Value::Dict& expected_final_values);
void GetAppStates(UpdaterScope updater_scope,
const base::Value::Dict& expected_app_states);
// Deletes the file.
void DeleteFile(UpdaterScope scope, const base::FilePath& path);
// Deletes the updater executable directory. Does not do any kind of cleanup
// related to service registration. The intent of this command is to replicate
// a common mode of breaking the updater, so we can test how it recovers.
void DeleteUpdaterDirectory(UpdaterScope scope);
// DeleteActiveUpdaterExecutable is a more narrowly-targeted tool for simulating
// a broken updater. Finds the executable for the active updater (including
// any copy owned by systemd), according to the active version on the global
// prefs file, and deletes it. Does not clean up service registrations, updater
// configuration, app registration, etc.
void DeleteActiveUpdaterExecutable(UpdaterScope scope);
// Runs the command and waits for it to exit or time out.
void Run(UpdaterScope scope,
base::CommandLine command_line,
int* exit_code = nullptr);
// Runs the command (via sudo if `elevate` is true) and waits for it to exit,
// then asserts that it returned the expected exit code (if provided) and
// its stdout was exactly the expected string (if provided).
void ExpectCliResult(base::CommandLine command_line,
bool elevate,
std::optional<std::string> want_stdout,
std::optional<int> want_exit_code);
// Returns the path of the Updater executable.
std::optional<base::FilePath> GetInstalledExecutablePath(UpdaterScope scope);
// Sets up a fake updater on the system at a version lower than the test.
void SetupFakeUpdaterLowerVersion(UpdaterScope scope);
// Gets the real updater lower version paths/versions.
std::vector<TestUpdaterVersion> GetRealUpdaterLowerVersions(
const std::string& arch_suffix = {});
// Gets the real updater current and lower version paths/versions.
std::vector<TestUpdaterVersion> GetRealUpdaterVersions();
// Sets up a real updater on the system given any (higher or lower) version of
// `UpdaterSetup.exe` in `updater_path`.
void SetupRealUpdater(UpdaterScope scope,
const base::FilePath& updater_path,
const base::Value::List& switches);
// Sets up a fake updater on the system at a version higher than the test.
void SetupFakeUpdaterHigherVersion(UpdaterScope scope);
// Expects that this version of updater is uninstalled from the system.
void ExpectCandidateUninstalled(UpdaterScope scope);
// Sets the active bit for `app_id`.
void SetActive(UpdaterScope scope, const std::string& app_id);
// Expects that the active bit for `app_id` is set.
void ExpectActive(UpdaterScope scope, const std::string& app_id);
// Expects that the active bit for `app_id` is unset.
void ExpectNotActive(UpdaterScope scope, const std::string& app_id);
void SetExistenceCheckerPath(UpdaterScope scope,
const std::string& app_id,
const base::FilePath& path);
void SetServerStarts(UpdaterScope scope, int value);
// Writes lots of data into the log file.
void FillLog(UpdaterScope scope);
// Confirms that an old log file exists and that the current log file is small.
void ExpectLogRotated(UpdaterScope scope);
void ExpectRegistered(UpdaterScope scope, const std::string& app_id);
void ExpectNotRegistered(UpdaterScope scope, const std::string& app_id);
void ExpectAppTag(UpdaterScope scope,
const std::string& app_id,
const std::string& tag);
void SetAppTag(UpdaterScope scope,
const std::string& app_id,
const std::string& tag);
void ExpectAppVersion(UpdaterScope scope,
const std::string& app_id,
const base::Version& version);
void RegisterApp(UpdaterScope scope, const RegistrationRequest& registration);
void RegisterAppByValue(UpdaterScope scope,
const base::Value::Dict& registration_data);
[[nodiscard]] bool WaitForUpdaterExit();
#if BUILDFLAG(IS_WIN)
void ExpectInterfacesRegistered(UpdaterScope scope);
void ExpectMarshalInterfaceSucceeds(UpdaterScope scope);
void ExpectLegacyUpdate3WebSucceeds(
UpdaterScope scope,
const std::string& app_id,
AppBundleWebCreateMode app_bundle_web_create_mode,
int expected_final_state,
int expected_error_code,
bool cancel_when_downloading);
void ExpectLegacyProcessLauncherSucceeds(UpdaterScope scope);
void ExpectLegacyAppCommandWebSucceeds(UpdaterScope scope,
const std::string& app_id,
const std::string& command_id,
const base::Value::List& parameters,
int expected_exit_code);
void ExpectPolicyStatusValues(
Microsoft::WRL::ComPtr<IPolicyStatusValue> policy_status_value,
const std::wstring& expected_source,
const std::wstring& expected_value,
VARIANT_BOOL expected_has_conflict);
void ExpectLegacyPolicyStatusSucceeds(UpdaterScope scope,
const base::Version& updater_version);
void LegacyInstallApp(UpdaterScope scope,
const std::string& app_id,
const base::Version& version);
// Calls a function defined in test/service/win/rpc_client.py.
// Entries of the `arguments` dictionary should be the function's parameter
// name/value pairs.
void InvokeTestServiceFunction(const std::string& function_name,
const base::Value::Dict& arguments);
void RunUninstallCmdLine(UpdaterScope scope);
void RunHandoff(UpdaterScope scope, const std::string& app_id);
#endif // BUILDFLAG(IS_WIN)
// Returns the number of files in the directory, not including directories,
// links, or dot dot.
int CountDirectoryFiles(const base::FilePath& dir);
void ExpectSelfUpdateSequence(UpdaterScope scope, ScopedServer* test_server);
void ExpectPing(UpdaterScope scope,
ScopedServer* test_server,
int event_type,
std::optional<GURL> target_url);
void ExpectAppCommandPing(UpdaterScope scope,
ScopedServer* test_server,
const std::string& appid,
const std::string& appcommandid,
int errorcode,
int eventresult,
int event_type,
const base::Version& version,
const base::Version& updater_version);
void ExpectUpdateCheckRequest(UpdaterScope scope, ScopedServer* test_server);
void ExpectUpdateCheckSequence(UpdaterScope scope,
ScopedServer* test_server,
const std::string& app_id,
UpdateService::Priority priority,
const base::Version& from_version,
const base::Version& to_version,
const base::Version& updater_version);
void ExpectUpdateSequence(
UpdaterScope scope,
ScopedServer* test_server,
const std::string& app_id,
const std::string& install_data_index,
UpdateService::Priority priority,
const base::Version& from_version,
const base::Version& to_version,
bool do_fault_injection,
bool skip_download,
const base::Version& updater_version = base::Version(kUpdaterVersion),
const std::string& event_regex = ".*");
void ExpectUpdateSequenceBadHash(UpdaterScope scope,
ScopedServer* test_server,
const std::string& app_id,
const std::string& install_data_index,
UpdateService::Priority priority,
const base::Version& from_version,
const base::Version& to_version);
void ExpectInstallSequence(UpdaterScope scope,
ScopedServer* test_server,
const std::string& app_id,
const std::string& install_data_index,
UpdateService::Priority priority,
const base::Version& from_version,
const base::Version& to_version,
bool do_fault_injection,
bool skip_download,
const base::Version& updater_version,
const std::string& event_regex);
void ExpectEnterpriseCompanionAppOTAInstallSequence(ScopedServer* test_server);
void ExpectAppsUpdateSequence(
UpdaterScope scope,
ScopedServer* test_server,
const base::Value::Dict& request_attributes,
const std::vector<AppUpdateExpectation>& apps,
const base::Version& updater_version = base::Version(kUpdaterVersion));
void StressUpdateService(UpdaterScope scope);
void CallServiceUpdate(UpdaterScope updater_scope,
const std::string& app_id,
const std::string& install_data_index,
bool same_version_update_allowed);
void SetupFakeLegacyUpdater(UpdaterScope scope);
#if BUILDFLAG(IS_WIN)
void RunFakeLegacyUpdater(UpdaterScope scope);
// Dismiss the installation completion dialog, then wait for the process
// exit.
void CloseInstallCompleteDialog(const std::u16string& bundle_name,
const std::wstring& lang,
const std::wstring& child_window_text_to_find,
bool verify_app_logo_loaded = false);
#endif // BUILDFLAG(IS_WIN)
#if BUILDFLAG(IS_MAC)
void PrivilegedHelperInstall(UpdaterScope scope);
void DeleteLegacyUpdater(UpdaterScope scope);
void ExpectPrepareToRunBundleSuccess(const base::FilePath& bundle_path);
#endif // BUILDFLAG(IS_MAC)
void ExpectLegacyUpdaterMigrated(UpdaterScope scope);
void RunRecoveryComponent(UpdaterScope scope,
const std::string& app_id,
const base::Version& version);
void SetLastChecked(UpdaterScope scope, base::Time time);
void ExpectLastChecked(UpdaterScope scope);
void ExpectLastStarted(UpdaterScope scope);
void InstallApp(UpdaterScope scope,
const std::string& app_id,
const base::Version& version);
void UninstallApp(UpdaterScope scope, const std::string& app_id);
void RunOfflineInstall(UpdaterScope scope,
bool is_legacy_install,
bool is_silent_install,
int installer_result,
int installer_error);
void RunOfflineInstallOsNotSupported(UpdaterScope scope,
bool is_legacy_install,
bool is_silent_install,
const std::string& language);
void RunMockOfflineMetaInstall(UpdaterScope scope,
const std::string& app_id,
const base::Version& version,
const std::string& tag,
const base::FilePath& installer_path,
const std::string& arguments,
bool is_silent_install,
const std::string& platform,
const std::string& installer_text,
const bool always_launch_cmd,
const int expected_exit_code,
bool expect_success);
base::CommandLine MakeElevated(base::CommandLine command_line);
// Stores a device management enrollment token and deletes any existing
// stored device management token (for the already-enrolled state).
// Requires root permissions.
void DMPushEnrollmentToken(const std::string& enrollment_token);
void DMDeregisterDevice(UpdaterScope scope);
void DMCleanup(UpdaterScope scope);
// Installs the enterprise companion app from the test's data deps, always at
// the system scope.
void InstallEnterpriseCompanionApp();
// Manually uninstalls the enterprise companion app installed via
// `InstallBrokenEnterpriseCompanionApp`. This should be done before the updater
// uninstalls, as the broken companion app is unable to uninstall itself which
// will cause the updater's uninstaller to return an error.
void UninstallBrokenEnterpriseCompanionApp();
// Installs a stub enterprise companion app which will fail to launch, always at
// the system scope.
void InstallBrokenEnterpriseCompanionApp();
// Installs the constants overrides for the enterprise companion app, always at
// the system scope.
void InstallEnterpriseCompanionAppOverrides(
const base::Value::Dict& external_overrides);
// Expects that the enterprise companion app is not installed, always at system
// scope.
void ExpectEnterpriseCompanionAppNotInstalled();
// Uninstalls the enterprise companion app, always at the system scope.
void UninstallEnterpriseCompanionApp();
// Configures whether an app allows the transmission of usage statistics. The
// app is indicated by a platform-specific `identifier` following the semantics
// of the event logging permission provider. That is, on macOS the basename of
// an application's directory within Application Support and an AppId on
// Windows.
void SetAppAllowsUsageStats(UpdaterScope scope,
const std::string& identifier,
bool allowed);
void ClearAppAllowsUsageStats(UpdaterScope scope,
const std::string& identifier);
void ExpectDeviceManagementRequest(ScopedServer* test_server,
const std::string& request_type,
const std::string& authorization_type,
const std::string& authorization_token,
net::HttpStatusCode response_status,
const std::string& response,
std::optional<GURL> target_url = {});
void ExpectDeviceManagementRegistrationRequest(
ScopedServer* test_server,
const std::string& enrollment_token,
const std::string& dm_token);
void ExpectDeviceManagementPolicyFetchRequest(
ScopedServer* test_server,
const std::string& dm_token,
const ::wireless_android_enterprise_devicemanagement::
OmahaSettingsClientProto& omaha_settings,
bool first_request = true,
bool rotate_public_key = false,
std::optional<GURL> target_url = std::nullopt);
void ExpectDeviceManagementTokenDeletionRequest(ScopedServer* test_server,
const std::string& dm_token,
bool invalidate_token);
void ExpectProxyPacScriptRequest(ScopedServer* test_server);
#if BUILDFLAG(IS_MAC)
void ExpectKSAdminResult(UpdaterScope scope,
bool elevate,
const std::map<std::string, std::string>& switches,
std::optional<std::string> want_stdout,
std::optional<int> want_exit_code);
// Expect ksadmin to fetch the specified tag for the specified product
// ID, including fetching the empty tag if no tag is specified, or to
// fail to retrieve a tag.
//
// Params:
// scope -- Picks which ksadmin binary to use.
// elevate -- Whether to run as root instead of the current user.
// product_id -- Product ID to fetch the tag for.
// xc_path -- Optional: Existence checker path to include in the tag
// lookup operation. If empty, the `--xc_path` switch is not
// provided to ksadmin at all.
// store_flag -- Adds the `--system_store` or `--user_store` switch to the
// ksadmin command line. Switch is omitted if nullopt.
// want_tag -- if valid, the tag that ksadmin is expected to successfully
// retrieve, which may be the empty string. If nullopt,
// specifies that `ksadmin` should return EXIT_FAILURE.
void ExpectKSAdminFetchTag(UpdaterScope scope,
bool elevate,
const std::string& product_id,
const base::FilePath& xc_path,
std::optional<UpdaterScope> store_flag,
std::optional<std::string> want_tag);
// Expect ksadmin to fetch the specified brand code from a tag stored in the
// `com.apple.application-instance` extended attribute of the item at the
// specified path, or to fail to retrieve a brand code.
//
// Params:
// scope -- Picks which ksadmin binary to use.
// elevate -- Whether to run as root instead of the current user.
// path -- Path to send to ksadmin via `--print-xattr-tag-brand`.
// want_brand -- if valid, the brand code that ksadmin is expected to
// successfully retrieve, which may be the empty string. If
// nullopt, specifies that ksadmin should return EXIT_FAILURE.
void ExpectKSAdminXattrBrand(UpdaterScope scope,
bool elevate,
const base::FilePath& path,
std::optional<std::string> want_brand);
#endif // BUILDFLAG(IS_MAC)
} // namespace updater::test
#endif // CHROME_UPDATER_TEST_INTEGRATION_TESTS_IMPL_H_
|