summaryrefslogtreecommitdiffstats
path: root/ppapi/tests/test_flash_drm.cc
diff options
context:
space:
mode:
authorraymes <raymes@chromium.org>2014-10-06 12:59:45 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-06 20:00:46 +0000
commit5a4fc2503ca9d45c28c60723fdc71cba0f7ea968 (patch)
treed6cec41cfdb20099815394a55df032313000b771 /ppapi/tests/test_flash_drm.cc
parent0c5e8d16661df7e08c708997f24c0a3070e58080 (diff)
downloadchromium_src-5a4fc2503ca9d45c28c60723fdc71cba0f7ea968.zip
chromium_src-5a4fc2503ca9d45c28c60723fdc71cba0f7ea968.tar.gz
chromium_src-5a4fc2503ca9d45c28c60723fdc71cba0f7ea968.tar.bz2
Fix the ppapi test for FlashDRM
This fixes the FlashDRM ppapi test which was failing because the test was assuming that the "Hmonitor" value would never be returned on Mac, but at some point it was implemented but the test was never changed. This changes the test to assume that a valid Hmonitor value will be returned on Mac (but doesn't actually check what the value is). BUG=419863 Review URL: https://codereview.chromium.org/626883002 Cr-Commit-Position: refs/heads/master@{#298298}
Diffstat (limited to 'ppapi/tests/test_flash_drm.cc')
-rw-r--r--ppapi/tests/test_flash_drm.cc34
1 files changed, 22 insertions, 12 deletions
diff --git a/ppapi/tests/test_flash_drm.cc b/ppapi/tests/test_flash_drm.cc
index 8daf18d..d76c640 100644
--- a/ppapi/tests/test_flash_drm.cc
+++ b/ppapi/tests/test_flash_drm.cc
@@ -27,9 +27,26 @@ using pp::PassRef;
using pp::Var;
namespace {
- const char kExepectedVoucherFilename[] = "plugin.vch";
+
+const char kExepectedVoucherFilename[] = "plugin.vch";
+
+// Check that the Hmonitor value is what it is expected to be for each platform.
+bool CheckExpectedHmonitorValue(bool success, int64_t hmonitor) {
+#if defined(PPAPI_OS_MACOSX)
+ // TODO(raymes): Verify the expected |hmonitor| value on Mac.
+ return success;
+#elif defined(PPAPI_OS_WIN)
+ MONITORINFO info = { sizeof(info) };
+ return success &&
+ ::GetMonitorInfo(reinterpret_cast<HMONITOR>(hmonitor), &info) == TRUE;
+#else
+ // Not implemented for other platforms, should return false.
+ return !success;
+#endif
}
+} // namespace
+
TestFlashDRM::TestFlashDRM(TestingInstance* instance)
: TestCase(instance),
callback_factory_(this) {
@@ -76,20 +93,13 @@ std::string TestFlashDRM::TestGetDeviceID() {
std::string TestFlashDRM::TestGetHmonitor() {
DRM drm(instance_);
int64_t hmonitor;
-#if defined(PPAPI_OS_WIN)
while (true) {
- if (drm.GetHmonitor(&hmonitor)) {
- MONITORINFO info = { sizeof(info) };
- ASSERT_EQ(TRUE,
- ::GetMonitorInfo(reinterpret_cast<HMONITOR>(hmonitor), &info));
+ bool success = drm.GetHmonitor(&hmonitor);
+ if (CheckExpectedHmonitorValue(success, hmonitor))
break;
- } else {
- ::Sleep(30);
- }
+ else
+ PlatformSleep(30);
}
-#else
- ASSERT_FALSE(drm.GetHmonitor(&hmonitor));
-#endif
PASS();
}