cros: Fix ash ScreenshotDelegate ownership and creation

Many ash_unittests fail under --mus and --mash because the
TestScreenshotDelegate is not created. This happens because of some
legacy AcceleratorControllerDelegate code that dates back ~18 months
to when we couldn't use aura::Window* in mash code. That isn't a
problem anymore.

* Move ownership of ScreenshotDelegate to ScreenshotController
* Create the delegate in ShellDelegate, similar to how we do other
  ash delegates
* Move screenshot accelerator code back into AcceleratorController
* Re-enable tests under mus and mash via filter files

Screenshots don't work yet under --mus and --mash due to lack of
graphics readback support and lack of a mojo interface, but we now
exercise more of the UI and accelerator handling code.

Bug: 557397, 632111
Test: ash_unittests (--mus, --mash), manually take screenshots
Change-Id: I7dd1946ddc30bddb407c9dbf6095caf8efb4fd1f
Reviewed-on: https://chromium-review.googlesource.com/744295
Reviewed-by: Michael Wasserman <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: Vladislav Kaznacheev <[email protected]>
Commit-Queue: James Cook <[email protected]>
Cr-Commit-Position: refs/heads/master@{#513018}
diff --git a/ash/mus/shell_delegate_mus.cc b/ash/mus/shell_delegate_mus.cc
index c428725..f0bba9b5f 100644
--- a/ash/mus/shell_delegate_mus.cc
+++ b/ash/mus/shell_delegate_mus.cc
@@ -10,6 +10,7 @@
 #include "ash/accessibility/default_accessibility_delegate.h"
 #include "ash/gpu_support_stub.h"
 #include "ash/mus/wallpaper_delegate_mus.h"
+#include "ash/screenshot_delegate.h"
 #include "base/strings/string16.h"
 #include "base/strings/string_util.h"
 #include "components/user_manager/user_info_impl.h"
@@ -18,6 +19,30 @@
 #include "ui/keyboard/keyboard_ui.h"
 
 namespace ash {
+namespace {
+
+// TODO(jamescook): Replace with a mojo-compatible ScreenshotClient.
+class ScreenshotDelegateMash : public ScreenshotDelegate {
+ public:
+  ScreenshotDelegateMash() = default;
+  ~ScreenshotDelegateMash() override = default;
+
+  // ScreenshotDelegate:
+  void HandleTakeScreenshotForAllRootWindows() override { NOTIMPLEMENTED(); }
+  void HandleTakePartialScreenshot(aura::Window* window,
+                                   const gfx::Rect& rect) override {
+    NOTIMPLEMENTED();
+  }
+  void HandleTakeWindowScreenshot(aura::Window* window) override {
+    NOTIMPLEMENTED();
+  }
+  bool CanTakeScreenshot() override { return true; }
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(ScreenshotDelegateMash);
+};
+
+}  // namespace
 
 ShellDelegateMus::ShellDelegateMus(service_manager::Connector* connector)
     : connector_(connector) {}
@@ -67,6 +92,11 @@
   return nullptr;
 }
 
+std::unique_ptr<ScreenshotDelegate>
+ShellDelegateMus::CreateScreenshotDelegate() {
+  return std::make_unique<ScreenshotDelegateMash>();
+}
+
 std::unique_ptr<WallpaperDelegate> ShellDelegateMus::CreateWallpaperDelegate() {
   return std::make_unique<WallpaperDelegateMus>();
 }