Chromium Code Reviews| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 EXPECT_FALSE(IsArcAvailable()); | 64 EXPECT_FALSE(IsArcAvailable()); |
| 65 | 65 |
| 66 { | 66 { |
| 67 ScopedArcFeature feature(true); | 67 ScopedArcFeature feature(true); |
| 68 EXPECT_TRUE(IsArcAvailable()); | 68 EXPECT_TRUE(IsArcAvailable()); |
| 69 } | 69 } |
| 70 { | 70 { |
| 71 ScopedArcFeature feature(false); | 71 ScopedArcFeature feature(false); |
| 72 EXPECT_FALSE(IsArcAvailable()); | 72 EXPECT_FALSE(IsArcAvailable()); |
| 73 } | 73 } |
| 74 | |
|
Yusuke Sato
2017/02/02 18:14:06
can you test "none"?
hidehiko
2017/02/03 15:37:42
Done.
| |
| 75 // If ARC is installed, IsArcAvailable() should return true when EnableARC | |
| 76 // feature is set. | |
| 77 command_line->InitFromArgv({"", "--arc-availability=installed"}); | |
| 78 | |
| 79 // Not available, by-default, too. | |
| 80 EXPECT_FALSE(IsArcAvailable()); | |
| 81 | |
| 82 { | |
| 83 ScopedArcFeature feature(true); | |
| 84 EXPECT_TRUE(IsArcAvailable()); | |
| 85 } | |
| 86 { | |
| 87 ScopedArcFeature feature(false); | |
| 88 EXPECT_FALSE(IsArcAvailable()); | |
| 89 } | |
| 74 } | 90 } |
| 75 | 91 |
| 76 TEST_F(ArcUtilTest, IsArcAvailable_OfficialSupport) { | 92 TEST_F(ArcUtilTest, IsArcAvailable_OfficialSupport) { |
| 77 // Regardless of FeatureList, IsArcAvailable() should return true. | 93 // Regardless of FeatureList, IsArcAvailable() should return true. |
| 78 auto* command_line = base::CommandLine::ForCurrentProcess(); | 94 auto* command_line = base::CommandLine::ForCurrentProcess(); |
| 79 command_line->InitFromArgv({"", "--enable-arc"}); | 95 command_line->InitFromArgv({"", "--enable-arc"}); |
| 80 EXPECT_TRUE(IsArcAvailable()); | 96 EXPECT_TRUE(IsArcAvailable()); |
| 97 | |
| 98 command_line->InitFromArgv({"", "--arc-availability=official-support"}); | |
| 99 EXPECT_TRUE(IsArcAvailable()); | |
| 81 } | 100 } |
| 82 | 101 |
| 83 // TODO(hidehiko): Add test for IsArcKioskMode(). | 102 // TODO(hidehiko): Add test for IsArcKioskMode(). |
| 84 // It depends on UserManager, but a utility to inject fake instance is | 103 // It depends on UserManager, but a utility to inject fake instance is |
| 85 // available only in chrome/. To use it in components/, refactoring is needed. | 104 // available only in chrome/. To use it in components/, refactoring is needed. |
| 86 | 105 |
| 87 TEST_F(ArcUtilTest, IsArcOptInVerificationDisabled) { | 106 TEST_F(ArcUtilTest, IsArcOptInVerificationDisabled) { |
| 88 auto* command_line = base::CommandLine::ForCurrentProcess(); | 107 auto* command_line = base::CommandLine::ForCurrentProcess(); |
| 89 command_line->InitFromArgv({""}); | 108 command_line->InitFromArgv({""}); |
| 90 EXPECT_FALSE(IsArcOptInVerificationDisabled()); | 109 EXPECT_FALSE(IsArcOptInVerificationDisabled()); |
| 91 | 110 |
| 92 command_line->InitFromArgv({"", "--disable-arc-opt-in-verification"}); | 111 command_line->InitFromArgv({"", "--disable-arc-opt-in-verification"}); |
| 93 EXPECT_TRUE(IsArcOptInVerificationDisabled()); | 112 EXPECT_TRUE(IsArcOptInVerificationDisabled()); |
| 94 } | 113 } |
| 95 | 114 |
| 96 } // namespace | 115 } // namespace |
| 97 } // namespace arc | 116 } // namespace arc |
| OLD | NEW |