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

Unified Diff: ppapi/tests/test_flash_fullscreen_for_browser_ui.cc

Issue 670653005: Fix Flash fullscreen focus regressions, and add interactive_ui_tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove consts in ObjC code. Created 6 years, 2 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
« no previous file with comments | « ppapi/tests/test_flash_fullscreen_for_browser_ui.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_flash_fullscreen_for_browser_ui.cc
diff --git a/ppapi/tests/test_flash_fullscreen_for_browser_ui.cc b/ppapi/tests/test_flash_fullscreen_for_browser_ui.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0e37339f43aa3a3c66cfc14c7c313180cd260948
--- /dev/null
+++ b/ppapi/tests/test_flash_fullscreen_for_browser_ui.cc
@@ -0,0 +1,91 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/tests/test_flash_fullscreen_for_browser_ui.h"
+
+#include "ppapi/cpp/input_event.h"
+#include "ppapi/cpp/instance.h"
+#include "ppapi/cpp/rect.h"
+#include "ppapi/tests/testing_instance.h"
+
+REGISTER_TEST_CASE(FlashFullscreenForBrowserUI);
+
+TestFlashFullscreenForBrowserUI::
+ TestFlashFullscreenForBrowserUI(TestingInstance* instance)
+ : TestCase(instance),
+ screen_mode_(instance),
+ view_change_event_(instance->pp_instance()),
+ num_trigger_events_(0),
+ callback_factory_(this) {
+ // This plugin should not be removed after this TestCase passes because
+ // browser UI testing requires it to remain and to be interactive.
+ instance_->set_remove_plugin(false);
+}
+
+TestFlashFullscreenForBrowserUI::~TestFlashFullscreenForBrowserUI() {
+}
+
+bool TestFlashFullscreenForBrowserUI::Init() {
+ return CheckTestingInterface();
+}
+
+void TestFlashFullscreenForBrowserUI::RunTests(const std::string& filter) {
+ RUN_TEST(EnterFullscreen, filter);
+}
+
+std::string TestFlashFullscreenForBrowserUI::TestEnterFullscreen() {
+ if (screen_mode_.IsFullscreen())
+ return ReportError("IsFullscreen() at start", true);
+
+ view_change_event_.Reset();
+ if (!screen_mode_.SetFullscreen(true))
+ return ReportError("SetFullscreen(true) in normal", false);
+ // DidChangeView() will call the callback once in fullscreen mode.
+ view_change_event_.Wait();
+
+ if (!screen_mode_.IsFullscreen())
+ return ReportError("IsFullscreen() in fullscreen", false);
+
+ const int32_t result =
+ instance_->RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_MOUSE |
+ PP_INPUTEVENT_CLASS_KEYBOARD);
+ if (result != PP_OK)
+ return ReportError("RequestFilteringInputEvents() failed", result);
+
+ PASS();
+}
+
+void TestFlashFullscreenForBrowserUI::DidChangeView(const pp::View& view) {
+ compositor_ = pp::Compositor(instance_);
+ instance_->BindGraphics(compositor_);
+ layer_size_ = view.GetRect().size();
+ color_layer_ = compositor_.AddLayer();
+ Paint(PP_OK);
+
+ view_change_event_.Signal();
+}
+
+bool TestFlashFullscreenForBrowserUI::HandleInputEvent(
+ const pp::InputEvent& event) {
+ if (event.GetType() != PP_INPUTEVENT_TYPE_MOUSEDOWN &&
+ event.GetType() != PP_INPUTEVENT_TYPE_CHAR) {
+ return false;
+ }
+
+ ++num_trigger_events_;
+
+ return true;
+}
+
+void TestFlashFullscreenForBrowserUI::Paint(int32_t last_compositor_result) {
+ if (num_trigger_events_ == 0)
+ color_layer_.SetColor(0.0f, 1.0f, 0.0f, 1.0f, layer_size_);
+ else if (num_trigger_events_ % 2)
+ color_layer_.SetColor(1.0f, 0.0f, 0.0f, 1.0f, layer_size_);
+ else
+ color_layer_.SetColor(0.0f, 0.0f, 1.0f, 1.0f, layer_size_);
+
+ compositor_.CommitLayers(
+ callback_factory_.NewCallback(&TestFlashFullscreenForBrowserUI::Paint));
+}
« no previous file with comments | « ppapi/tests/test_flash_fullscreen_for_browser_ui.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698