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/sys_info.h" | |
| 5 #include "base/values.h" | 6 #include "base/values.h" |
| 6 #include "chrome/browser/chromeos/arc/arc_util.h" | 7 #include "chrome/browser/chromeos/arc/arc_util.h" |
| 7 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 8 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 8 #include "chrome/browser/chromeos/settings/cros_settings.h" | 9 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 9 #include "chrome/browser/chromeos/settings/stub_install_attributes.h" | 10 #include "chrome/browser/chromeos/settings/stub_install_attributes.h" |
| 10 #include "chrome/browser/extensions/extension_apitest.h" | 11 #include "chrome/browser/extensions/extension_apitest.h" |
| 11 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
| 12 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 13 #include "chromeos/settings/cros_settings_names.h" | 14 #include "chromeos/settings/cros_settings_names.h" |
| 14 #include "components/arc/arc_util.h" | 15 #include "components/arc/arc_util.h" |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 25 ChromeOSInfoPrivateTest() {} | 26 ChromeOSInfoPrivateTest() {} |
| 26 ~ChromeOSInfoPrivateTest() override {} | 27 ~ChromeOSInfoPrivateTest() override {} |
| 27 | 28 |
| 28 protected: | 29 protected: |
| 29 void EnableKioskSession() { | 30 void EnableKioskSession() { |
| 30 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 31 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 31 switches::kForceAppMode); | 32 switches::kForceAppMode); |
| 32 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kAppId, | 33 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kAppId, |
| 33 kTestAppId); | 34 kTestAppId); |
| 34 } | 35 } |
| 36 | |
| 37 void SetDeviceType(const std::string& device_type) { | |
| 38 const std::string lsb_release = | |
| 39 base::StringPrintf("DEVICETYPE=%s", device_type.c_str()); | |
|
Alexander Alekseev
2017/03/22 09:31:26
const std::string lsb_release = std::string("DEVIC
Wenzhao (Colin) Zang
2017/03/23 01:17:16
Done.
| |
| 40 base::SysInfo::SetChromeOSVersionInfoForTest(lsb_release, | |
| 41 base::Time::Now()); | |
| 42 } | |
| 35 }; | 43 }; |
| 36 | 44 |
| 37 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, TestGetAndSet) { | 45 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, TestGetAndSet) { |
| 38 // Set the initial timezone different from what JS function | 46 // Set the initial timezone different from what JS function |
| 39 // timezoneSetTest() will attempt to set. | 47 // timezoneSetTest() will attempt to set. |
| 40 base::Value initial_timezone("America/Los_Angeles"); | 48 base::Value initial_timezone("America/Los_Angeles"); |
| 41 chromeos::CrosSettings::Get()->Set(chromeos::kSystemTimezone, | 49 chromeos::CrosSettings::Get()->Set(chromeos::kSystemTimezone, |
| 42 initial_timezone); | 50 initial_timezone); |
| 43 | 51 |
| 44 // Check that accessibility settings are set to default values. | 52 // Check that accessibility settings are set to default values. |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 75 RunPlatformAppTestWithArg("chromeos_info_private/extended", "kiosk")) | 83 RunPlatformAppTestWithArg("chromeos_info_private/extended", "kiosk")) |
| 76 << message_; | 84 << message_; |
| 77 } | 85 } |
| 78 | 86 |
| 79 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, ArcNotAvailable) { | 87 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, ArcNotAvailable) { |
| 80 ASSERT_TRUE(RunPlatformAppTestWithArg("chromeos_info_private/extended", | 88 ASSERT_TRUE(RunPlatformAppTestWithArg("chromeos_info_private/extended", |
| 81 "arc not-available")) | 89 "arc not-available")) |
| 82 << message_; | 90 << message_; |
| 83 } | 91 } |
| 84 | 92 |
| 93 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, Chromebase) { | |
| 94 SetDeviceType("CHROMEBASE"); | |
| 95 ASSERT_TRUE( | |
| 96 RunPlatformAppTestWithArg("chromeos_info_private/extended", "chromebase")) | |
| 97 << message_; | |
| 98 } | |
| 99 | |
| 100 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, Chromebit) { | |
| 101 SetDeviceType("CHROMEBIT"); | |
| 102 ASSERT_TRUE( | |
| 103 RunPlatformAppTestWithArg("chromeos_info_private/extended", "chromebit")) | |
| 104 << message_; | |
| 105 } | |
| 106 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, Chromebook) { | |
| 107 SetDeviceType("CHROMEBOOK"); | |
| 108 ASSERT_TRUE( | |
| 109 RunPlatformAppTestWithArg("chromeos_info_private/extended", "chromebook")) | |
| 110 << message_; | |
| 111 } | |
| 112 | |
| 113 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, Chromebox) { | |
| 114 SetDeviceType("CHROMEBOX"); | |
| 115 ASSERT_TRUE( | |
| 116 RunPlatformAppTestWithArg("chromeos_info_private/extended", "chromebox")) | |
| 117 << message_; | |
| 118 } | |
| 119 | |
| 120 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, UnknownDeviceType) { | |
| 121 SetDeviceType("UNKNOWN"); | |
| 122 ASSERT_TRUE(RunPlatformAppTestWithArg("chromeos_info_private/extended", | |
| 123 "unknown device type")) | |
|
tbarzic
2017/03/22 16:42:19
just "unknown"?
| |
| 124 << message_; | |
| 125 } | |
| 126 | |
| 85 class ChromeOSArcInfoPrivateTest : public ChromeOSInfoPrivateTest { | 127 class ChromeOSArcInfoPrivateTest : public ChromeOSInfoPrivateTest { |
| 86 public: | 128 public: |
| 87 ChromeOSArcInfoPrivateTest() = default; | 129 ChromeOSArcInfoPrivateTest() = default; |
| 88 ~ChromeOSArcInfoPrivateTest() override = default; | 130 ~ChromeOSArcInfoPrivateTest() override = default; |
| 89 | 131 |
| 90 void SetUpCommandLine(base::CommandLine* command_line) override { | 132 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 91 ExtensionApiTest::SetUpCommandLine(command_line); | 133 ExtensionApiTest::SetUpCommandLine(command_line); |
| 92 // Make ARC enabled for ArcAvailable/ArcEnabled tests. | 134 // Make ARC enabled for ArcAvailable/ArcEnabled tests. |
| 93 arc::SetArcAvailableCommandLineForTesting(command_line); | 135 arc::SetArcAvailableCommandLineForTesting(command_line); |
| 94 } | 136 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 | 175 |
| 134 private: | 176 private: |
| 135 DISALLOW_COPY_AND_ASSIGN(ChromeOSManagedDeviceInfoPrivateTest); | 177 DISALLOW_COPY_AND_ASSIGN(ChromeOSManagedDeviceInfoPrivateTest); |
| 136 }; | 178 }; |
| 137 | 179 |
| 138 IN_PROC_BROWSER_TEST_F(ChromeOSManagedDeviceInfoPrivateTest, Managed) { | 180 IN_PROC_BROWSER_TEST_F(ChromeOSManagedDeviceInfoPrivateTest, Managed) { |
| 139 ASSERT_TRUE( | 181 ASSERT_TRUE( |
| 140 RunPlatformAppTestWithArg("chromeos_info_private/extended", "managed")) | 182 RunPlatformAppTestWithArg("chromeos_info_private/extended", "managed")) |
| 141 << message_; | 183 << message_; |
| 142 } | 184 } |
| OLD | NEW |