summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorpolina@google.com <polina@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-29 02:56:28 +0000
committerpolina@google.com <polina@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-29 02:56:28 +0000
commit53f1a000c4cd5fcb2a74609a518ec074dcc46e3b (patch)
tree62c69105cd30fb6e0412ee6635739dad05c34890 /ppapi
parentcd681c453a82ab32086917f92884a5072cda46ae (diff)
downloadchromium_src-53f1a000c4cd5fcb2a74609a518ec074dcc46e3b.zip
chromium_src-53f1a000c4cd5fcb2a74609a518ec074dcc46e3b.tar.gz
chromium_src-53f1a000c4cd5fcb2a74609a518ec074dcc46e3b.tar.bz2
PPAPI SetFullscreen: Do return PP_FALSE when transition cannot be process. The cases include:
- going into fullscreen when not processing a user gesture - requesting a duplicate transition Update tests. BUG=41780 TEST=Pepper and NaCl tests, manually Review URL: http://codereview.chromium.org/8070018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103232 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/native_client/tests/ppapi_browser/ppb_fullscreen/ppapi_ppb_fullscreen.cc13
-rw-r--r--ppapi/tests/test_fullscreen.cc19
2 files changed, 24 insertions, 8 deletions
diff --git a/ppapi/native_client/tests/ppapi_browser/ppb_fullscreen/ppapi_ppb_fullscreen.cc b/ppapi/native_client/tests/ppapi_browser/ppb_fullscreen/ppapi_ppb_fullscreen.cc
index 90eb935..959b7bb 100644
--- a/ppapi/native_client/tests/ppapi_browser/ppb_fullscreen/ppapi_ppb_fullscreen.cc
+++ b/ppapi/native_client/tests/ppapi_browser/ppb_fullscreen/ppapi_ppb_fullscreen.cc
@@ -99,12 +99,13 @@ void TestSetFullscreenTrue() {
// Transition to fullscreen.
// This can only be done when processing a user gesture -
// see HandleInputEvent().
+ EXPECT(ppb->SetFullscreen(pp_instance(), PP_TRUE) == PP_FALSE);
EXPECT(PPBInputEvent()->
RequestInputEvents(pp_instance(),
PP_INPUTEVENT_CLASS_MOUSE) == PP_OK);
} else {
// No change.
- EXPECT(ppb->SetFullscreen(pp_instance(), PP_TRUE) == PP_TRUE);
+ EXPECT(ppb->SetFullscreen(pp_instance(), PP_TRUE) == PP_FALSE);
EXPECT(ppb->IsFullscreen(pp_instance()) == PP_TRUE);
TEST_PASSED;
}
@@ -117,8 +118,10 @@ void TestSetFullscreenFalse() {
// Transition out of fullscreen.
EXPECT(CreateGraphics2D(&g_graphics2d));
// The transition is asynchronous and ends at the next DidChangeView().
- g_normal_pending = true;
EXPECT(ppb->SetFullscreen(pp_instance(), PP_FALSE) == PP_TRUE);
+ g_normal_pending = true;
+ // Transition is pending, so repeated requests fail.
+ EXPECT(ppb->SetFullscreen(pp_instance(), PP_FALSE) == PP_FALSE);
EXPECT(ppb->IsFullscreen(pp_instance()) == PP_TRUE);
// No 2D or 3D device can be bound during transition.
EXPECT(PPBGraphics2D()->IsGraphics2D(g_graphics2d) == PP_TRUE);
@@ -127,7 +130,7 @@ void TestSetFullscreenFalse() {
// The transition ends at the next DidChangeView().
} else {
// No change.
- EXPECT(ppb->SetFullscreen(pp_instance(), PP_FALSE) == PP_TRUE);
+ EXPECT(ppb->SetFullscreen(pp_instance(), PP_FALSE) == PP_FALSE);
EXPECT(ppb->IsFullscreen(pp_instance()) == PP_FALSE);
TEST_PASSED;
}
@@ -177,8 +180,10 @@ PP_Bool HandleInputEvent(PP_Instance instance, PP_Resource event) {
PP_INPUTEVENT_CLASS_MOUSE);
EXPECT(PPBFullscreenDev()->IsFullscreen(pp_instance()) == PP_FALSE);
EXPECT(CreateGraphics2D(&g_graphics2d));
- g_fullscreen_pending = true;
EXPECT(PPBFullscreenDev()->SetFullscreen(pp_instance(), PP_TRUE) == PP_TRUE);
+ g_fullscreen_pending = true;
+ // Transition is pending, so repeated requests fail.
+ EXPECT(PPBFullscreenDev()->SetFullscreen(pp_instance(), PP_TRUE) == PP_FALSE);
EXPECT(PPBFullscreenDev()->IsFullscreen(pp_instance()) == PP_FALSE);
// No 2D or 3D device can be bound during transition.
EXPECT(PPBGraphics2D()->IsGraphics2D(g_graphics2d) == PP_TRUE);
diff --git a/ppapi/tests/test_fullscreen.cc b/ppapi/tests/test_fullscreen.cc
index bcac8f3..226d03d 100644
--- a/ppapi/tests/test_fullscreen.cc
+++ b/ppapi/tests/test_fullscreen.cc
@@ -80,6 +80,8 @@ std::string TestFullscreen::TestNormalToFullscreenToNormal() {
// 1. Switch to fullscreen.
// This is only allowed within a context of a user gesture (e.g. mouse click).
+ if (screen_mode_.SetFullscreen(true))
+ return ReportError("SetFullscreen(true) outside of user gesture", true);
// The transition is asynchronous and ends at the next DidChangeView().
// No graphics devices can be bound while in transition.
instance_->RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE);
@@ -96,8 +98,8 @@ std::string TestFullscreen::TestNormalToFullscreenToNormal() {
return ReportError("BindGraphics() in fullscreen", false);
// 2. Stay in fullscreen. No change.
- if (!screen_mode_.SetFullscreen(true))
- return ReportError("SetFullscreen(true) in fullscreen", false);
+ if (screen_mode_.SetFullscreen(true))
+ return ReportError("SetFullscreen(true) in fullscreen", true);
if (!screen_mode_.IsFullscreen())
return ReportError("IsFullscreen() in fullscreen^2", false);
@@ -107,6 +109,9 @@ std::string TestFullscreen::TestNormalToFullscreenToNormal() {
normal_pending_ = true;
if (!screen_mode_.SetFullscreen(false))
return ReportError("SetFullscreen(false) in fullscreen", false);
+ // Normal is now pending, so repeated requests should fail.
+ if (screen_mode_.SetFullscreen(false))
+ return ReportError("SetFullscreen(false) in normal pending", true);
if (instance_->BindGraphics(graphics2d_normal_))
return ReportError("BindGraphics() in normal transition", true);
if (!screen_mode_.IsFullscreen())
@@ -121,8 +126,8 @@ std::string TestFullscreen::TestNormalToFullscreenToNormal() {
return ReportError("BindGraphics() in normal", false);
// 4. Stay in normal. No change.
- if (!screen_mode_.SetFullscreen(false))
- return ReportError("SetFullscreen(false) in normal", false);
+ if (screen_mode_.SetFullscreen(false))
+ return ReportError("SetFullscreen(false) in normal", true);
if (screen_mode_.IsFullscreen())
return ReportError("IsFullscreen() in normal^2", true);
@@ -149,6 +154,12 @@ bool TestFullscreen::HandleInputEvent(const pp::InputEvent& event) {
FailFullscreenTest(ReportError("SetFullscreen(true) in normal", false));
return false;
}
+ // Fullscreen is now pending, so repeated requests should fail.
+ if (screen_mode_.SetFullscreen(true)) {
+ FailFullscreenTest(
+ ReportError("SetFullscreen(true) in fullscreen pending", true));
+ return false;
+ }
// No graphics devices can be bound while in transition.
if (instance_->BindGraphics(graphics2d_fullscreen_)) {
FailFullscreenTest(