| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/common/system/chromeos/palette/mock_palette_tool_delegate.h" | 5 #include "ash/common/system/chromeos/palette/mock_palette_tool_delegate.h" |
| 6 #include "ash/common/system/chromeos/palette/palette_ids.h" | 6 #include "ash/common/system/chromeos/palette/palette_ids.h" |
| 7 #include "ash/common/system/chromeos/palette/palette_tool.h" | 7 #include "ash/common/system/chromeos/palette/palette_tool.h" |
| 8 #include "ash/common/system/chromeos/palette/tools/capture_region_mode.h" | 8 #include "ash/common/system/chromeos/palette/tools/capture_region_mode.h" |
| 9 #include "ash/common/system/chromeos/palette/tools/capture_screen_action.h" | 9 #include "ash/common/system/chromeos/palette/tools/capture_screen_action.h" |
| 10 #include "ash/common/test/test_palette_delegate.h" | 10 #include "ash/common/test/test_palette_delegate.h" |
| 11 #include "ash/common/wm_shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/test/ash_test_base.h" | 12 #include "ash/test/ash_test_base.h" |
| 13 #include "ash/test/shell_test_api.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 15 | 16 |
| 16 namespace ash { | 17 namespace ash { |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 // Base class for all create note ash tests. | 21 // Base class for all create note ash tests. |
| 21 class ScreenshotToolTest : public test::AshTestBase { | 22 class ScreenshotToolTest : public test::AshTestBase { |
| 22 public: | 23 public: |
| 23 ScreenshotToolTest() {} | 24 ScreenshotToolTest() {} |
| 24 ~ScreenshotToolTest() override {} | 25 ~ScreenshotToolTest() override {} |
| 25 | 26 |
| 26 void SetUp() override { | 27 void SetUp() override { |
| 27 test::AshTestBase::SetUp(); | 28 test::AshTestBase::SetUp(); |
| 28 | 29 |
| 29 WmShell::Get()->SetPaletteDelegateForTesting( | 30 test::ShellTestApi().SetPaletteDelegate( |
| 30 base::MakeUnique<TestPaletteDelegate>()); | 31 base::MakeUnique<TestPaletteDelegate>()); |
| 31 | 32 |
| 32 palette_tool_delegate_ = base::MakeUnique<MockPaletteToolDelegate>(); | 33 palette_tool_delegate_ = base::MakeUnique<MockPaletteToolDelegate>(); |
| 33 } | 34 } |
| 34 | 35 |
| 35 TestPaletteDelegate* test_palette_delegate() { | 36 TestPaletteDelegate* test_palette_delegate() { |
| 36 return static_cast<TestPaletteDelegate*>( | 37 return static_cast<TestPaletteDelegate*>( |
| 37 WmShell::Get()->palette_delegate()); | 38 Shell::GetInstance()->palette_delegate()); |
| 38 } | 39 } |
| 39 | 40 |
| 40 protected: | 41 protected: |
| 41 std::unique_ptr<MockPaletteToolDelegate> palette_tool_delegate_; | 42 std::unique_ptr<MockPaletteToolDelegate> palette_tool_delegate_; |
| 42 | 43 |
| 43 private: | 44 private: |
| 44 DISALLOW_COPY_AND_ASSIGN(ScreenshotToolTest); | 45 DISALLOW_COPY_AND_ASSIGN(ScreenshotToolTest); |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 } // namespace | 48 } // namespace |
| (...skipping 24 matching lines...) Expand all Loading... |
| 72 std::unique_ptr<PaletteTool> tool = | 73 std::unique_ptr<PaletteTool> tool = |
| 73 base::MakeUnique<CaptureScreenAction>(palette_tool_delegate_.get()); | 74 base::MakeUnique<CaptureScreenAction>(palette_tool_delegate_.get()); |
| 74 EXPECT_CALL(*palette_tool_delegate_.get(), | 75 EXPECT_CALL(*palette_tool_delegate_.get(), |
| 75 DisableTool(PaletteToolId::CAPTURE_SCREEN)); | 76 DisableTool(PaletteToolId::CAPTURE_SCREEN)); |
| 76 EXPECT_CALL(*palette_tool_delegate_.get(), HidePaletteImmediately()); | 77 EXPECT_CALL(*palette_tool_delegate_.get(), HidePaletteImmediately()); |
| 77 tool->OnEnable(); | 78 tool->OnEnable(); |
| 78 EXPECT_EQ(1, test_palette_delegate()->take_screenshot_count()); | 79 EXPECT_EQ(1, test_palette_delegate()->take_screenshot_count()); |
| 79 } | 80 } |
| 80 | 81 |
| 81 } // namespace ash | 82 } // namespace ash |
| OLD | NEW |