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/browser_process.h" | |
|
tbarzic
2017/02/22 02:18:35
nit: this is not needed, is it?
Wenzhao (Colin) Zang
2017/02/22 03:11:06
Done.
| |
| 6 #include "chrome/browser/chromeos/arc/arc_util.h" | 7 #include "chrome/browser/chromeos/arc/arc_util.h" |
| 8 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | |
| 7 #include "chrome/browser/chromeos/settings/cros_settings.h" | 9 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 10 #include "chrome/browser/chromeos/settings/stub_install_attributes.h" | |
| 8 #include "chrome/browser/extensions/extension_apitest.h" | 11 #include "chrome/browser/extensions/extension_apitest.h" |
| 9 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
| 10 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 11 #include "chromeos/settings/cros_settings_names.h" | 14 #include "chromeos/settings/cros_settings_names.h" |
| 12 #include "components/arc/arc_util.h" | 15 #include "components/arc/arc_util.h" |
| 13 #include "components/prefs/pref_service.h" | 16 #include "components/prefs/pref_service.h" |
| 14 | 17 |
| 15 namespace { | 18 namespace { |
| 16 | 19 |
| 17 const char kTestAppId[] = "ljoammodoonkhnehlncldjelhidljdpi"; | 20 const char kTestAppId[] = "ljoammodoonkhnehlncldjelhidljdpi"; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 // Even if ARC is available, ARC may not be able to be enabled. (Please | 108 // Even if ARC is available, ARC may not be able to be enabled. (Please |
| 106 // see arc::IsArcAllowedForProfile() for details). | 109 // see arc::IsArcAllowedForProfile() for details). |
| 107 // In such cases, we expect "available". However, current testing framework | 110 // In such cases, we expect "available". However, current testing framework |
| 108 // does not seem to run with such cases, unfortunately. So, here directly | 111 // does not seem to run with such cases, unfortunately. So, here directly |
| 109 // control the function. | 112 // control the function. |
| 110 arc::DisallowArcForTesting(); | 113 arc::DisallowArcForTesting(); |
| 111 ASSERT_TRUE(RunPlatformAppTestWithArg("chromeos_info_private/extended", | 114 ASSERT_TRUE(RunPlatformAppTestWithArg("chromeos_info_private/extended", |
| 112 "arc available")) | 115 "arc available")) |
| 113 << message_; | 116 << message_; |
| 114 } | 117 } |
| 118 | |
| 119 class ChromeOSManagedDeviceInfoPrivateTest : public ChromeOSInfoPrivateTest { | |
| 120 public: | |
| 121 ChromeOSManagedDeviceInfoPrivateTest() = default; | |
| 122 ~ChromeOSManagedDeviceInfoPrivateTest() override = default; | |
| 123 | |
| 124 protected: | |
| 125 void SetUpInProcessBrowserTestFixture() override { | |
| 126 // Set up fake install attributes. | |
| 127 std::unique_ptr<chromeos::StubInstallAttributes> attributes = | |
| 128 base::MakeUnique<chromeos::StubInstallAttributes>(); | |
| 129 attributes->SetEnterprise("fake-domain", "fake-id"); | |
| 130 policy::BrowserPolicyConnectorChromeOS::SetInstallAttributesForTesting( | |
| 131 attributes.release()); | |
| 132 ChromeOSInfoPrivateTest::SetUpInProcessBrowserTestFixture(); | |
| 133 } | |
|
tbarzic
2017/02/22 02:18:35
nit: add DISALLOW_COPY_AND_ASSIGN
Wenzhao (Colin) Zang
2017/02/22 03:11:07
Done.
| |
| 134 }; | |
| 135 | |
| 136 IN_PROC_BROWSER_TEST_F(ChromeOSManagedDeviceInfoPrivateTest, Managed) { | |
|
Rahul Chaturvedi
2017/02/22 00:00:13
Nit: You want to test all the code paths here. Thi
Wenzhao (Colin) Zang
2017/02/22 00:39:04
The unmanaged value is default and the code path h
| |
| 137 // The default status is not managed, which is tested by | |
| 138 // ChromeOSInfoPrivateTest. | |
| 139 ASSERT_TRUE( | |
| 140 RunPlatformAppTestWithArg("chromeos_info_private/extended", "managed")) | |
| 141 << message_; | |
| 142 } | |
| OLD | NEW |