Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(749)

Unified Diff: ash/common/system/chromeos/palette/tools/screenshot_unittest.cc

Issue 2291913002: Allow the user to cancel the capture region action, and show its active status in the tray. (Closed)
Patch Set: Address comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,
« no previous file with comments | « ash/common/system/chromeos/palette/tools/capture_region_mode.cc ('k') | ash/common/test/test_palette_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698