| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "components/arc/arc_util.h" | 5 #include "components/arc/arc_util.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 TEST_F(ArcUtilTest, IsArcAvailable_OfficiallySupported) { | 106 TEST_F(ArcUtilTest, IsArcAvailable_OfficiallySupported) { |
| 107 // Regardless of FeatureList, IsArcAvailable() should return true. | 107 // Regardless of FeatureList, IsArcAvailable() should return true. |
| 108 auto* command_line = base::CommandLine::ForCurrentProcess(); | 108 auto* command_line = base::CommandLine::ForCurrentProcess(); |
| 109 command_line->InitFromArgv({"", "--enable-arc"}); | 109 command_line->InitFromArgv({"", "--enable-arc"}); |
| 110 EXPECT_TRUE(IsArcAvailable()); | 110 EXPECT_TRUE(IsArcAvailable()); |
| 111 | 111 |
| 112 command_line->InitFromArgv({"", "--arc-availability=officially-supported"}); | 112 command_line->InitFromArgv({"", "--arc-availability=officially-supported"}); |
| 113 EXPECT_TRUE(IsArcAvailable()); | 113 EXPECT_TRUE(IsArcAvailable()); |
| 114 } | 114 } |
| 115 | 115 |
| 116 TEST_F(ArcUtilTest, IsArcAvailable_OfficiallySupportedWithActiveDirectory) { |
| 117 // Regardless of FeatureList, IsArcAvailable() should return true. |
| 118 auto* command_line = base::CommandLine::ForCurrentProcess(); |
| 119 command_line->InitFromArgv( |
| 120 {"", "--arc-availability=officially-supported-with-active-directory"}); |
| 121 EXPECT_TRUE(IsArcAvailable()); |
| 122 } |
| 123 |
| 124 TEST_F(ArcUtilTest, IsArcAllowedForActiveDirectoryUsers_Allowed) { |
| 125 auto* command_line = base::CommandLine::ForCurrentProcess(); |
| 126 command_line->InitFromArgv( |
| 127 {"", "--arc-availability=officially-supported-with-active-directory"}); |
| 128 EXPECT_TRUE(IsArcAllowedForActiveDirectoryUsers()); |
| 129 } |
| 130 |
| 131 TEST_F(ArcUtilTest, IsArcAllowedForActiveDirectoryUsers_NotAllowed) { |
| 132 auto* command_line = base::CommandLine::ForCurrentProcess(); |
| 133 command_line->InitFromArgv({"", "--arc-availability=officially-supported"}); |
| 134 EXPECT_FALSE(IsArcAllowedForActiveDirectoryUsers()); |
| 135 } |
| 136 |
| 116 // TODO(hidehiko): Add test for IsArcKioskMode(). | 137 // TODO(hidehiko): Add test for IsArcKioskMode(). |
| 117 // It depends on UserManager, but a utility to inject fake instance is | 138 // It depends on UserManager, but a utility to inject fake instance is |
| 118 // available only in chrome/. To use it in components/, refactoring is needed. | 139 // available only in chrome/. To use it in components/, refactoring is needed. |
| 119 | 140 |
| 120 TEST_F(ArcUtilTest, IsArcOptInVerificationDisabled) { | 141 TEST_F(ArcUtilTest, IsArcOptInVerificationDisabled) { |
| 121 auto* command_line = base::CommandLine::ForCurrentProcess(); | 142 auto* command_line = base::CommandLine::ForCurrentProcess(); |
| 122 command_line->InitFromArgv({""}); | 143 command_line->InitFromArgv({""}); |
| 123 EXPECT_FALSE(IsArcOptInVerificationDisabled()); | 144 EXPECT_FALSE(IsArcOptInVerificationDisabled()); |
| 124 | 145 |
| 125 command_line->InitFromArgv({"", "--disable-arc-opt-in-verification"}); | 146 command_line->InitFromArgv({"", "--disable-arc-opt-in-verification"}); |
| 126 EXPECT_TRUE(IsArcOptInVerificationDisabled()); | 147 EXPECT_TRUE(IsArcOptInVerificationDisabled()); |
| 127 } | 148 } |
| 128 | 149 |
| 129 } // namespace | 150 } // namespace |
| 130 } // namespace arc | 151 } // namespace arc |
| OLD | NEW |