Chromium Code Reviews| Index: chrome/browser/chromeos/extensions/info_private_apitest.cc |
| diff --git a/chrome/browser/chromeos/extensions/info_private_apitest.cc b/chrome/browser/chromeos/extensions/info_private_apitest.cc |
| index 7f7e35e84a91472abb44410d53deed7f3ae829dc..d599b498c85ac1cd77fe963d0ec19cb1b72ef186 100644 |
| --- a/chrome/browser/chromeos/extensions/info_private_apitest.cc |
| +++ b/chrome/browser/chromeos/extensions/info_private_apitest.cc |
| @@ -3,12 +3,13 @@ |
| // found in the LICENSE file. |
| #include "base/values.h" |
| +#include "chrome/browser/chromeos/arc/arc_session_manager.h" |
| #include "chrome/browser/chromeos/settings/cros_settings.h" |
| #include "chrome/browser/extensions/extension_apitest.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/pref_names.h" |
| -#include "chromeos/chromeos_switches.h" |
| #include "chromeos/settings/cros_settings_names.h" |
| +#include "components/arc/arc_util.h" |
| #include "components/prefs/pref_service.h" |
| namespace { |
| @@ -22,6 +23,12 @@ class ChromeOSInfoPrivateTest : public ExtensionApiTest { |
| ChromeOSInfoPrivateTest() {} |
| ~ChromeOSInfoPrivateTest() override {} |
| + void SetUpCommandLine(base::CommandLine* command_line) override { |
| + ExtensionApiTest::SetUpCommandLine(command_line); |
| + // Make ARC enabled for ArcAvailable/ArcEnabled tests. |
| + arc::SetArcAvailableCommandLineForTesting(command_line); |
| + } |
| + |
| protected: |
| void EnableKioskSession() { |
| base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| @@ -29,16 +36,6 @@ class ChromeOSInfoPrivateTest : public ExtensionApiTest { |
| base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kAppId, |
| kTestAppId); |
| } |
| - |
| - void MakeArcAvailable() { |
| - base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| - chromeos::switches::kArcAvailable); |
| - } |
| - |
| - void EnableArc() { |
| - base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| - chromeos::switches::kEnableArc); |
| - } |
| }; |
| IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, TestGetAndSet) { |
| @@ -83,16 +80,20 @@ IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, Kiosk) { |
| << message_; |
| } |
| -IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, ArcAvailable) { |
| - MakeArcAvailable(); |
| +IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, ArcEnabled) { |
|
Rahul Chaturvedi
2017/01/26 06:31:22
I hate to nit-pick, but these tests will now alway
hidehiko
2017/01/26 06:51:07
Sure, done.
Instead of "not enabled", I named "not
|
| ASSERT_TRUE(RunPlatformAppTestWithArg("chromeos_info_private/extended", |
| - "arc available")) |
| + "arc enabled")) |
| << message_; |
| } |
| -IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, ArcEnabled) { |
| - EnableArc(); |
| +IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, ArcAvailable) { |
| + // Even if ARC is available, ARC may not be able to be enabled. (Please |
| + // see ArcSessionManager::IsAllowedForProfile() for details). |
| + // In such cases, we expect "available". However, current testing framework |
| + // does not seem to run with such cases, unfortunately. So, here directly |
| + // control the function. |
| + arc::ArcSessionManager::DisallowForTesting(); |
| ASSERT_TRUE(RunPlatformAppTestWithArg("chromeos_info_private/extended", |
| - "arc enabled")) |
| + "arc available")) |
| << message_; |
| } |