Index: ash/common/system/chromeos/palette/tools/screenshot_unittest.cc |
diff --git a/ash/common/system/chromeos/palette/tools/screenshot_unittest.cc b/ash/common/system/chromeos/palette/tools/screenshot_unittest.cc |
index ad932980463b4855377a077ab1673913dc7b50ef..4e3fe4ceb89294772c71c4d10fb966f730edaafe 100644 |
--- a/ash/common/system/chromeos/palette/tools/screenshot_unittest.cc |
+++ b/ash/common/system/chromeos/palette/tools/screenshot_unittest.cc |
@@ -5,7 +5,7 @@ |
#include "ash/common/system/chromeos/palette/mock_palette_tool_delegate.h" |
#include "ash/common/system/chromeos/palette/palette_ids.h" |
#include "ash/common/system/chromeos/palette/palette_tool.h" |
-#include "ash/common/system/chromeos/palette/tools/capture_region_action.h" |
+#include "ash/common/system/chromeos/palette/tools/capture_region_mode.h" |
#include "ash/common/system/chromeos/palette/tools/capture_screen_action.h" |
#include "ash/common/test/test_palette_delegate.h" |
#include "ash/common/wm_shell.h" |
@@ -47,15 +47,23 @@ class ScreenshotToolTest : public test::AshTestBase { |
} // namespace |
// Verifies that capturing a region triggers the partial screenshot delegate |
-// method, disables the tool, and hides the palette. |
+// method. Invoking the callback passed to the delegate disables the tool. |
TEST_F(ScreenshotToolTest, EnablingCaptureRegionCallsDelegateAndDisablesTool) { |
std::unique_ptr<PaletteTool> tool = |
- base::MakeUnique<CaptureRegionAction>(palette_tool_delegate_.get()); |
- EXPECT_CALL(*palette_tool_delegate_.get(), |
- DisableTool(PaletteToolId::CAPTURE_REGION)); |
+ base::MakeUnique<CaptureRegionMode>(palette_tool_delegate_.get()); |
+ |
+ // Starting a partial screenshot calls the calls the palette delegate to start |
+ // a screenshot session and hides the palette. |
EXPECT_CALL(*palette_tool_delegate_.get(), HidePalette()); |
tool->OnEnable(); |
EXPECT_EQ(1, test_palette_delegate()->take_partial_screenshot_count()); |
+ testing::Mock::VerifyAndClearExpectations(palette_tool_delegate_.get()); |
+ |
+ // Calling the associated callback (partial screenshot finished) will disable |
+ // the tool. |
+ EXPECT_CALL(*palette_tool_delegate_.get(), |
+ DisableTool(PaletteToolId::CAPTURE_REGION)); |
+ test_palette_delegate()->partial_screenshot_done().Run(); |
} |
// Verifies that capturing the screen triggers the screenshot delegate method, |