Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: chrome/browser/chromeos/extensions/info_private_apitest.cc

Issue 2761263007: ChromeOS: Expose 'device type' signal (Closed)
Patch Set: replace StringPrintf with string Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 = std::string("DEVICETYPE=") + device_type;
39 base::SysInfo::SetChromeOSVersionInfoForTest(lsb_release,
40 base::Time::Now());
41 }
35 }; 42 };
36 43
37 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, TestGetAndSet) { 44 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, TestGetAndSet) {
38 // Set the initial timezone different from what JS function 45 // Set the initial timezone different from what JS function
39 // timezoneSetTest() will attempt to set. 46 // timezoneSetTest() will attempt to set.
40 base::Value initial_timezone("America/Los_Angeles"); 47 base::Value initial_timezone("America/Los_Angeles");
41 chromeos::CrosSettings::Get()->Set(chromeos::kSystemTimezone, 48 chromeos::CrosSettings::Get()->Set(chromeos::kSystemTimezone,
42 initial_timezone); 49 initial_timezone);
43 50
44 // Check that accessibility settings are set to default values. 51 // Check that accessibility settings are set to default values.
(...skipping 30 matching lines...) Expand all
75 RunPlatformAppTestWithArg("chromeos_info_private/extended", "kiosk")) 82 RunPlatformAppTestWithArg("chromeos_info_private/extended", "kiosk"))
76 << message_; 83 << message_;
77 } 84 }
78 85
79 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, ArcNotAvailable) { 86 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, ArcNotAvailable) {
80 ASSERT_TRUE(RunPlatformAppTestWithArg("chromeos_info_private/extended", 87 ASSERT_TRUE(RunPlatformAppTestWithArg("chromeos_info_private/extended",
81 "arc not-available")) 88 "arc not-available"))
82 << message_; 89 << message_;
83 } 90 }
84 91
92 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, Chromebase) {
93 SetDeviceType("CHROMEBASE");
94 ASSERT_TRUE(
95 RunPlatformAppTestWithArg("chromeos_info_private/extended", "chromebase"))
96 << message_;
97 }
98
99 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, Chromebit) {
100 SetDeviceType("CHROMEBIT");
101 ASSERT_TRUE(
102 RunPlatformAppTestWithArg("chromeos_info_private/extended", "chromebit"))
103 << message_;
104 }
105 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, Chromebook) {
106 SetDeviceType("CHROMEBOOK");
107 ASSERT_TRUE(
108 RunPlatformAppTestWithArg("chromeos_info_private/extended", "chromebook"))
109 << message_;
110 }
111
112 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, Chromebox) {
113 SetDeviceType("CHROMEBOX");
114 ASSERT_TRUE(
115 RunPlatformAppTestWithArg("chromeos_info_private/extended", "chromebox"))
116 << message_;
117 }
118
119 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, UnknownDeviceType) {
120 SetDeviceType("UNKNOWN");
121 ASSERT_TRUE(RunPlatformAppTestWithArg("chromeos_info_private/extended",
122 "unknown device type"))
123 << message_;
124 }
125
85 class ChromeOSArcInfoPrivateTest : public ChromeOSInfoPrivateTest { 126 class ChromeOSArcInfoPrivateTest : public ChromeOSInfoPrivateTest {
86 public: 127 public:
87 ChromeOSArcInfoPrivateTest() = default; 128 ChromeOSArcInfoPrivateTest() = default;
88 ~ChromeOSArcInfoPrivateTest() override = default; 129 ~ChromeOSArcInfoPrivateTest() override = default;
89 130
90 void SetUpCommandLine(base::CommandLine* command_line) override { 131 void SetUpCommandLine(base::CommandLine* command_line) override {
91 ExtensionApiTest::SetUpCommandLine(command_line); 132 ExtensionApiTest::SetUpCommandLine(command_line);
92 // Make ARC enabled for ArcAvailable/ArcEnabled tests. 133 // Make ARC enabled for ArcAvailable/ArcEnabled tests.
93 arc::SetArcAvailableCommandLineForTesting(command_line); 134 arc::SetArcAvailableCommandLineForTesting(command_line);
94 } 135 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 174
134 private: 175 private:
135 DISALLOW_COPY_AND_ASSIGN(ChromeOSManagedDeviceInfoPrivateTest); 176 DISALLOW_COPY_AND_ASSIGN(ChromeOSManagedDeviceInfoPrivateTest);
136 }; 177 };
137 178
138 IN_PROC_BROWSER_TEST_F(ChromeOSManagedDeviceInfoPrivateTest, Managed) { 179 IN_PROC_BROWSER_TEST_F(ChromeOSManagedDeviceInfoPrivateTest, Managed) {
139 ASSERT_TRUE( 180 ASSERT_TRUE(
140 RunPlatformAppTestWithArg("chromeos_info_private/extended", "managed")) 181 RunPlatformAppTestWithArg("chromeos_info_private/extended", "managed"))
141 << message_; 182 << message_;
142 } 183 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/info_private_api.cc ('k') | chrome/common/extensions/api/chromeos_info_private.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698