| Index: chrome/installer/mini_installer/configuration_test.cc
|
| diff --git a/chrome/installer/mini_installer/configuration_test.cc b/chrome/installer/mini_installer/configuration_test.cc
|
| index cd38950f408ecb78132d7a6afb8f5ccea432ab71..9844a9faceb9d848c6369d10d5734d41ccd59995 100644
|
| --- a/chrome/installer/mini_installer/configuration_test.cc
|
| +++ b/chrome/installer/mini_installer/configuration_test.cc
|
| @@ -7,11 +7,34 @@
|
| #include <stddef.h>
|
| #include <stdlib.h>
|
|
|
| +#include <memory>
|
| +
|
| +#include "base/environment.h"
|
| #include "chrome/installer/mini_installer/appid.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| using mini_installer::Configuration;
|
|
|
| +namespace {
|
| +
|
| +// A helper class to set the "GoogleUpdateIsMachine" environment variable.
|
| +class ScopedGoogleUpdateIsMachine {
|
| + public:
|
| + explicit ScopedGoogleUpdateIsMachine(bool value)
|
| + : env_(base::Environment::Create()) {
|
| + env_->SetVar("GoogleUpdateIsMachine", value ? "1" : "0");
|
| + }
|
| +
|
| + ~ScopedGoogleUpdateIsMachine() {
|
| + env_->UnSetVar("GoogleUpdateIsMachine");
|
| + }
|
| +
|
| + private:
|
| + std::unique_ptr<base::Environment> env_;
|
| +};
|
| +
|
| +} // namespace
|
| +
|
| class TestConfiguration : public Configuration {
|
| public:
|
| explicit TestConfiguration(const wchar_t* command_line)
|
| @@ -160,4 +183,14 @@ TEST(MiniInstallerConfigurationTest, IsSystemLevel) {
|
| EXPECT_FALSE(TestConfiguration(L"spam.exe").is_system_level());
|
| EXPECT_FALSE(TestConfiguration(L"spam.exe --chrome").is_system_level());
|
| EXPECT_TRUE(TestConfiguration(L"spam.exe --system-level").is_system_level());
|
| +
|
| + {
|
| + ScopedGoogleUpdateIsMachine env_setter(false);
|
| + EXPECT_FALSE(TestConfiguration(L"spam.exe").is_system_level());
|
| + }
|
| +
|
| + {
|
| + ScopedGoogleUpdateIsMachine env_setter(true);
|
| + EXPECT_TRUE(TestConfiguration(L"spam.exe").is_system_level());
|
| + }
|
| }
|
|
|