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

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

Issue 2332193002: Add sessionType and playStoreStatus to chromeosInfoPrivate. (Closed)
Patch Set: Created 4 years, 3 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/values.h"
5 #include "chrome/browser/chromeos/settings/cros_settings.h" 6 #include "chrome/browser/chromeos/settings/cros_settings.h"
6 #include "chrome/browser/extensions/extension_apitest.h" 7 #include "chrome/browser/extensions/extension_apitest.h"
8 #include "chrome/common/chrome_switches.h"
7 #include "chrome/common/pref_names.h" 9 #include "chrome/common/pref_names.h"
10 #include "chromeos/chromeos_switches.h"
8 #include "chromeos/settings/cros_settings_names.h" 11 #include "chromeos/settings/cros_settings_names.h"
9 #include "components/prefs/pref_service.h" 12 #include "components/prefs/pref_service.h"
10 13
11 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeOSInfoPrivateTest) { 14 namespace {
15
16 const char kTestAppId[] = "ljoammodoonkhnehlncldjelhidljdpi";
17
18 } // namespace
19
20 class ChromeOSInfoPrivateTest : public ExtensionApiTest {
21 public:
22 ChromeOSInfoPrivateTest() {}
23 ~ChromeOSInfoPrivateTest() override {}
24
25 protected:
26 void EnableKioskSession() {
27 base::CommandLine::ForCurrentProcess()->AppendSwitch(
28 switches::kForceAppMode);
29 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kAppId,
30 kTestAppId);
31 }
32
33 void MakeArcAvailable() {
34 base::CommandLine::ForCurrentProcess()->AppendSwitch(
35 chromeos::switches::kArcAvailable);
36 }
37
38 void EnableArc() {
39 base::CommandLine::ForCurrentProcess()->AppendSwitch(
40 chromeos::switches::kEnableArc);
41 }
42 };
43
44 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, TestGetAndSet) {
12 // Set the initial timezone different from what JS function 45 // Set the initial timezone different from what JS function
13 // timezoneSetTest() will attempt to set. 46 // timezoneSetTest() will attempt to set.
14 base::StringValue initial_timezone("America/Los_Angeles"); 47 base::StringValue initial_timezone("America/Los_Angeles");
15 chromeos::CrosSettings::Get()->Set(chromeos::kSystemTimezone, 48 chromeos::CrosSettings::Get()->Set(chromeos::kSystemTimezone,
16 initial_timezone); 49 initial_timezone);
17 50
18 // Check that accessibility settings are set to default values. 51 // Check that accessibility settings are set to default values.
19 PrefService* prefs = profile()->GetPrefs(); 52 PrefService* prefs = profile()->GetPrefs();
20 ASSERT_FALSE(prefs->GetBoolean(prefs::kAccessibilityLargeCursorEnabled)); 53 ASSERT_FALSE(prefs->GetBoolean(prefs::kAccessibilityLargeCursorEnabled));
21 ASSERT_FALSE(prefs->GetBoolean(prefs::kAccessibilityStickyKeysEnabled)); 54 ASSERT_FALSE(prefs->GetBoolean(prefs::kAccessibilityStickyKeysEnabled));
22 ASSERT_FALSE(prefs->GetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled)); 55 ASSERT_FALSE(prefs->GetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled));
23 ASSERT_FALSE(prefs->GetBoolean(prefs::kAccessibilityHighContrastEnabled)); 56 ASSERT_FALSE(prefs->GetBoolean(prefs::kAccessibilityHighContrastEnabled));
24 ASSERT_FALSE(prefs->GetBoolean(prefs::kAccessibilityScreenMagnifierEnabled)); 57 ASSERT_FALSE(prefs->GetBoolean(prefs::kAccessibilityScreenMagnifierEnabled));
25 ASSERT_FALSE(prefs->GetBoolean(prefs::kAccessibilityAutoclickEnabled)); 58 ASSERT_FALSE(prefs->GetBoolean(prefs::kAccessibilityAutoclickEnabled));
26 59
27 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean( 60 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean(
28 prefs::kLanguageSendFunctionKeys)); 61 prefs::kLanguageSendFunctionKeys));
29 62
30 ASSERT_TRUE(RunComponentExtensionTest("chromeos_info_private")) << message_; 63 ASSERT_TRUE(RunComponentExtensionTest("chromeos_info_private/basic"))
64 << message_;
31 65
32 // Check that all accessibility settings have been flipped by the test. 66 // Check that all accessibility settings have been flipped by the test.
33 ASSERT_TRUE(prefs->GetBoolean(prefs::kAccessibilityLargeCursorEnabled)); 67 ASSERT_TRUE(prefs->GetBoolean(prefs::kAccessibilityLargeCursorEnabled));
34 ASSERT_TRUE(prefs->GetBoolean(prefs::kAccessibilityStickyKeysEnabled)); 68 ASSERT_TRUE(prefs->GetBoolean(prefs::kAccessibilityStickyKeysEnabled));
35 ASSERT_TRUE(prefs->GetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled)); 69 ASSERT_TRUE(prefs->GetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled));
36 ASSERT_TRUE(prefs->GetBoolean(prefs::kAccessibilityHighContrastEnabled)); 70 ASSERT_TRUE(prefs->GetBoolean(prefs::kAccessibilityHighContrastEnabled));
37 ASSERT_TRUE(prefs->GetBoolean(prefs::kAccessibilityScreenMagnifierEnabled)); 71 ASSERT_TRUE(prefs->GetBoolean(prefs::kAccessibilityScreenMagnifierEnabled));
38 ASSERT_TRUE(prefs->GetBoolean(prefs::kAccessibilityAutoclickEnabled)); 72 ASSERT_TRUE(prefs->GetBoolean(prefs::kAccessibilityAutoclickEnabled));
39 73
40 ASSERT_TRUE(prefs->GetBoolean(prefs::kLanguageSendFunctionKeys)); 74 ASSERT_TRUE(prefs->GetBoolean(prefs::kLanguageSendFunctionKeys));
41 } 75 }
76
77 // TODO(steel): Investigate merging the following tests.
78
79 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, Kiosk) {
80 EnableKioskSession();
81 ASSERT_TRUE(
82 RunPlatformAppTestWithArg("chromeos_info_private/extended", "kiosk"))
83 << message_;
84 }
85
86 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, ArcAvailable) {
87 MakeArcAvailable();
88 ASSERT_TRUE(RunPlatformAppTestWithArg("chromeos_info_private/extended",
89 "arc available"))
90 << message_;
91 }
92
93 IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, ArcEnabled) {
94 EnableArc();
95 ASSERT_TRUE(RunPlatformAppTestWithArg("chromeos_info_private/extended",
96 "arc enabled"))
97 << message_;
98 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/info_private_api.cc ('k') | chrome/common/extensions/api/_permission_features.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698