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