Home | History | Annotate | Download | only in tests
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef PAPPI_TESTS_TEST_FULLSCREEN_H_
      6 #define PAPPI_TESTS_TEST_FULLSCREEN_H_
      7 
      8 #include <string>
      9 
     10 #include "ppapi/cpp/fullscreen.h"
     11 #include "ppapi/cpp/graphics_2d.h"
     12 #include "ppapi/cpp/rect.h"
     13 #include "ppapi/cpp/size.h"
     14 #include "ppapi/tests/test_case.h"
     15 #include "ppapi/tests/test_utils.h"
     16 
     17 namespace pp {
     18 class InputEvent;
     19 }  // namespace pp
     20 
     21 struct ColorPremul { uint32_t A, R, G, B; };  // Use premultipled Alpha.
     22 
     23 class TestFullscreen : public TestCase {
     24  public:
     25   explicit TestFullscreen(TestingInstance* instance);
     26 
     27   // TestCase implementation.
     28   virtual bool Init();
     29   virtual void RunTests(const std::string& filter);
     30   virtual bool HandleInputEvent(const pp::InputEvent& event);
     31   virtual void DidChangeView(const pp::View& view);
     32 
     33   void CheckPluginPaint();
     34 
     35  private:
     36   std::string TestGetScreenSize();
     37   std::string TestNormalToFullscreenToNormal();
     38 
     39   void SimulateUserGesture();
     40   void FailFullscreenTest(const std::string& error);
     41   void FailNormalTest(const std::string& error);
     42   void PassFullscreenTest();
     43   void PassNormalTest();
     44   bool PaintPlugin(pp::Size size, ColorPremul color);
     45 
     46   bool GotError();
     47   std::string Error();
     48 
     49   std::string error_;
     50 
     51   pp::Fullscreen screen_mode_;
     52   pp::Size screen_size_;
     53   pp::Rect normal_position_;
     54   pp::Size painted_size_;
     55   uint32_t painted_color_;
     56 
     57   bool fullscreen_pending_;
     58   bool normal_pending_;
     59   pp::Graphics2D graphics2d_;
     60 
     61   NestedEvent fullscreen_event_;
     62   NestedEvent normal_event_;
     63 };
     64 
     65 #endif  // PAPPI_TESTS_TEST_FULLSCREEN_H_
     66