OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ppapi/tests/test_fullscreen.h" | 5 #include "ppapi/tests/test_fullscreen.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include <string.h> | 8 #include <string.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "ppapi/c/dev/ppb_testing_dev.h" | 11 #include "ppapi/c/dev/ppb_testing_dev.h" |
12 #include "ppapi/c/ppb_fullscreen.h" | 12 #include "ppapi/c/ppb_fullscreen.h" |
13 #include "ppapi/cpp/image_data.h" | 13 #include "ppapi/cpp/image_data.h" |
14 #include "ppapi/cpp/input_event.h" | 14 #include "ppapi/cpp/input_event.h" |
15 #include "ppapi/cpp/instance.h" | 15 #include "ppapi/cpp/instance.h" |
16 #include "ppapi/cpp/module.h" | 16 #include "ppapi/cpp/module.h" |
17 #include "ppapi/cpp/point.h" | 17 #include "ppapi/cpp/point.h" |
18 #include "ppapi/tests/test_utils.h" | 18 #include "ppapi/tests/test_utils.h" |
19 #include "ppapi/tests/testing_instance.h" | 19 #include "ppapi/tests/testing_instance.h" |
20 | 20 |
21 REGISTER_TEST_CASE(Fullscreen); | 21 REGISTER_TEST_CASE(Fullscreen); |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 const ColorPremul kOpaqueWhite = { 0xFF, 0xFF, 0xFF, 0xFF }; | |
26 const ColorPremul kSheerRed = { 0x88, 0x88, 0x00, 0x00 }; | |
27 const ColorPremul kSheerBlue = { 0x88, 0x00, 0x00, 0x88 }; | 25 const ColorPremul kSheerBlue = { 0x88, 0x00, 0x00, 0x88 }; |
28 const ColorPremul kOpaqueYellow = { 0xFF, 0xFF, 0xFF, 0x00 }; | 26 const ColorPremul kOpaqueYellow = { 0xFF, 0xFF, 0xFF, 0x00 }; |
29 const int kBytesPerPixel = sizeof(uint32_t); // 4 bytes for BGRA or RGBA. | 27 const int kBytesPerPixel = sizeof(uint32_t); // 4 bytes for BGRA or RGBA. |
30 | 28 |
31 uint32_t FormatColor(PP_ImageDataFormat format, ColorPremul color) { | 29 uint32_t FormatColor(PP_ImageDataFormat format, ColorPremul color) { |
32 if (format == PP_IMAGEDATAFORMAT_BGRA_PREMUL) | 30 if (format == PP_IMAGEDATAFORMAT_BGRA_PREMUL) |
33 return (color.A << 24) | (color.R << 16) | (color.G << 8) | (color.B); | 31 return (color.A << 24) | (color.R << 16) | (color.G << 8) | (color.B); |
34 else if (format == PP_IMAGEDATAFORMAT_RGBA_PREMUL) | 32 else if (format == PP_IMAGEDATAFORMAT_RGBA_PREMUL) |
35 return (color.A << 24) | (color.B << 16) | (color.G << 8) | (color.R); | 33 return (color.A << 24) | (color.B << 16) | (color.G << 8) | (color.R); |
36 else | 34 else |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 } else if (normal_pending_ && !is_fullscreen) { | 294 } else if (normal_pending_ && !is_fullscreen) { |
297 normal_pending_ = false; | 295 normal_pending_ = false; |
298 if (screen_mode_.IsFullscreen()) | 296 if (screen_mode_.IsFullscreen()) |
299 FailNormalTest("DidChangeview is in fullscreen"); | 297 FailNormalTest("DidChangeview is in fullscreen"); |
300 else if (!instance_->BindGraphics(graphics2d_)) | 298 else if (!instance_->BindGraphics(graphics2d_)) |
301 FailNormalTest("Failed to BindGraphics() in normal"); | 299 FailNormalTest("Failed to BindGraphics() in normal"); |
302 else if (!PaintPlugin(position.size(), kSheerBlue)) | 300 else if (!PaintPlugin(position.size(), kSheerBlue)) |
303 FailNormalTest("Failed to paint plugin image in normal"); | 301 FailNormalTest("Failed to paint plugin image in normal"); |
304 } | 302 } |
305 } | 303 } |
OLD | NEW |