| 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 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/shared/app_types.h" |
| 10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 13 #include "base/test/scoped_feature_list.h" | 14 #include "base/test/scoped_feature_list.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "ui/aura/client/aura_constants.h" |
| 17 #include "ui/aura/test/test_windows.h" |
| 18 #include "ui/aura/window.h" |
| 15 | 19 |
| 16 namespace arc { | 20 namespace arc { |
| 17 namespace { | 21 namespace { |
| 18 | 22 |
| 19 // If an instance is created, based on the value passed to the consturctor, | 23 // If an instance is created, based on the value passed to the consturctor, |
| 20 // EnableARC feature is enabled/disabled in the scope. | 24 // EnableARC feature is enabled/disabled in the scope. |
| 21 class ScopedArcFeature { | 25 class ScopedArcFeature { |
| 22 public: | 26 public: |
| 23 explicit ScopedArcFeature(bool enabled) { | 27 explicit ScopedArcFeature(bool enabled) { |
| 24 constexpr char kArcFeatureName[] = "EnableARC"; | 28 constexpr char kArcFeatureName[] = "EnableARC"; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 160 |
| 157 TEST_F(ArcUtilTest, IsArcOptInVerificationDisabled) { | 161 TEST_F(ArcUtilTest, IsArcOptInVerificationDisabled) { |
| 158 auto* command_line = base::CommandLine::ForCurrentProcess(); | 162 auto* command_line = base::CommandLine::ForCurrentProcess(); |
| 159 command_line->InitFromArgv({""}); | 163 command_line->InitFromArgv({""}); |
| 160 EXPECT_FALSE(IsArcOptInVerificationDisabled()); | 164 EXPECT_FALSE(IsArcOptInVerificationDisabled()); |
| 161 | 165 |
| 162 command_line->InitFromArgv({"", "--disable-arc-opt-in-verification"}); | 166 command_line->InitFromArgv({"", "--disable-arc-opt-in-verification"}); |
| 163 EXPECT_TRUE(IsArcOptInVerificationDisabled()); | 167 EXPECT_TRUE(IsArcOptInVerificationDisabled()); |
| 164 } | 168 } |
| 165 | 169 |
| 170 TEST_F(ArcUtilTest, IsArcAppWindow) { |
| 171 std::unique_ptr<aura::Window> window( |
| 172 aura::test::CreateTestWindowWithId(0, nullptr)); |
| 173 EXPECT_FALSE(IsArcAppWindow(window.get())); |
| 174 |
| 175 window->SetProperty(aura::client::kAppType, |
| 176 static_cast<int>(ash::AppType::CHROME_APP)); |
| 177 EXPECT_FALSE(IsArcAppWindow(window.get())); |
| 178 window->SetProperty(aura::client::kAppType, |
| 179 static_cast<int>(ash::AppType::ARC_APP)); |
| 180 EXPECT_TRUE(IsArcAppWindow(window.get())); |
| 181 |
| 182 EXPECT_FALSE(IsArcAppWindow(nullptr)); |
| 183 } |
| 184 |
| 166 } // namespace | 185 } // namespace |
| 167 } // namespace arc | 186 } // namespace arc |
| OLD | NEW |