Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/values.h" | 5 #include "base/values.h" |
| 6 #include "chrome/browser/chromeos/arc/arc_session_manager.h" | |
| 6 #include "chrome/browser/chromeos/settings/cros_settings.h" | 7 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 7 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
| 8 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 9 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
| 10 #include "chromeos/chromeos_switches.h" | 11 #include "chromeos/chromeos_switches.h" |
| 11 #include "chromeos/settings/cros_settings_names.h" | 12 #include "chromeos/settings/cros_settings_names.h" |
| 12 #include "components/prefs/pref_service.h" | 13 #include "components/prefs/pref_service.h" |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 const char kTestAppId[] = "ljoammodoonkhnehlncldjelhidljdpi"; | 17 const char kTestAppId[] = "ljoammodoonkhnehlncldjelhidljdpi"; |
| 17 | 18 |
| 18 } // namespace | 19 } // namespace |
| 19 | 20 |
| 20 class ChromeOSInfoPrivateTest : public ExtensionApiTest { | 21 class ChromeOSInfoPrivateTest : public ExtensionApiTest { |
| 21 public: | 22 public: |
| 22 ChromeOSInfoPrivateTest() {} | 23 ChromeOSInfoPrivateTest() {} |
| 23 ~ChromeOSInfoPrivateTest() override {} | 24 ~ChromeOSInfoPrivateTest() override {} |
| 24 | 25 |
| 25 protected: | 26 protected: |
| 26 void EnableKioskSession() { | 27 void EnableKioskSession() { |
| 27 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 28 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 28 switches::kForceAppMode); | 29 switches::kForceAppMode); |
| 29 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kAppId, | 30 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kAppId, |
| 30 kTestAppId); | 31 kTestAppId); |
| 31 } | 32 } |
| 32 | 33 |
| 33 void MakeArcAvailable() { | 34 void MakeArcAvailable() { |
| 34 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 35 // TODO(hidehiko): Introduce a utility to let IsArcAvailable() return true |
|
hidehiko
2017/01/24 10:57:36
Note: As many other tests do something similar to
| |
| 35 chromeos::switches::kArcAvailable); | 36 // for testing. |
| 36 } | |
| 37 | |
| 38 void EnableArc() { | |
| 39 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 37 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 40 chromeos::switches::kEnableArc); | 38 chromeos::switches::kEnableArc); |
| 41 } | 39 } |
| 42 }; | 40 }; |
| 43 | 41 |
| 44 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, TestGetAndSet) { | 42 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, TestGetAndSet) { |
| 45 // Set the initial timezone different from what JS function | 43 // Set the initial timezone different from what JS function |
| 46 // timezoneSetTest() will attempt to set. | 44 // timezoneSetTest() will attempt to set. |
| 47 base::StringValue initial_timezone("America/Los_Angeles"); | 45 base::StringValue initial_timezone("America/Los_Angeles"); |
| 48 chromeos::CrosSettings::Get()->Set(chromeos::kSystemTimezone, | 46 chromeos::CrosSettings::Get()->Set(chromeos::kSystemTimezone, |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 76 | 74 |
| 77 // TODO(steel): Investigate merging the following tests. | 75 // TODO(steel): Investigate merging the following tests. |
| 78 | 76 |
| 79 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, Kiosk) { | 77 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, Kiosk) { |
| 80 EnableKioskSession(); | 78 EnableKioskSession(); |
| 81 ASSERT_TRUE( | 79 ASSERT_TRUE( |
| 82 RunPlatformAppTestWithArg("chromeos_info_private/extended", "kiosk")) | 80 RunPlatformAppTestWithArg("chromeos_info_private/extended", "kiosk")) |
| 83 << message_; | 81 << message_; |
| 84 } | 82 } |
| 85 | 83 |
| 86 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, ArcAvailable) { | 84 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, ArcAvailable) { |
|
Luis Héctor Chávez
2017/01/24 17:00:37
This name is confusing. Can you change it to ArcAv
hidehiko
2017/01/24 18:05:56
Done.
| |
| 87 MakeArcAvailable(); | 85 MakeArcAvailable(); |
| 86 arc::ArcSessionManager::DisallowForTesting(); | |
| 88 ASSERT_TRUE(RunPlatformAppTestWithArg("chromeos_info_private/extended", | 87 ASSERT_TRUE(RunPlatformAppTestWithArg("chromeos_info_private/extended", |
| 89 "arc available")) | 88 "arc available")) |
| 90 << message_; | 89 << message_; |
| 91 } | 90 } |
| 92 | |
| 93 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, ArcEnabled) { | |
| 94 EnableArc(); | |
| 95 ASSERT_TRUE(RunPlatformAppTestWithArg("chromeos_info_private/extended", | |
| 96 "arc enabled")) | |
|
xiyuan
2017/01/24 17:52:38
Is this test case no longer needed? If so, also up
hidehiko
2017/01/24 18:05:56
Good catch. Done.
| |
| 97 << message_; | |
| 98 } | |
| OLD | NEW |