| 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_flash_device_id.h" | 5 #include "ppapi/tests/test_flash_drm.h" |
| 6 | 6 |
| 7 #include "ppapi/c/pp_macros.h" | 7 #include "ppapi/c/pp_macros.h" |
| 8 #include "ppapi/c/private/ppb_flash_device_id.h" | 8 #include "ppapi/c/private/ppb_flash_drm.h" |
| 9 #include "ppapi/cpp/instance.h" | 9 #include "ppapi/cpp/instance.h" |
| 10 #include "ppapi/cpp/module.h" | 10 #include "ppapi/cpp/module.h" |
| 11 #include "ppapi/cpp/private/flash_device_id.h" | 11 #include "ppapi/cpp/private/flash_device_id.h" |
| 12 #include "ppapi/cpp/private/flash_drm.h" |
| 12 #include "ppapi/cpp/var.h" | 13 #include "ppapi/cpp/var.h" |
| 13 #include "ppapi/tests/testing_instance.h" | 14 #include "ppapi/tests/testing_instance.h" |
| 14 | 15 |
| 15 REGISTER_TEST_CASE(FlashDeviceID); | 16 REGISTER_TEST_CASE(FlashDRM); |
| 16 | 17 |
| 17 using pp::flash::DeviceID; | 18 using pp::flash::DeviceID; |
| 19 using pp::flash::DRM; |
| 18 using pp::Var; | 20 using pp::Var; |
| 19 | 21 |
| 20 TestFlashDeviceID::TestFlashDeviceID(TestingInstance* instance) | 22 TestFlashDRM::TestFlashDRM(TestingInstance* instance) |
| 21 : TestCase(instance), | 23 : TestCase(instance), |
| 22 PP_ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)) { | 24 PP_ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)) { |
| 23 } | 25 } |
| 24 | 26 |
| 25 void TestFlashDeviceID::RunTests(const std::string& filter) { | 27 void TestFlashDRM::RunTests(const std::string& filter) { |
| 26 RUN_TEST(GetDeviceID, filter); | 28 RUN_TEST(GetDeviceID, filter); |
| 27 } | 29 } |
| 28 | 30 |
| 29 std::string TestFlashDeviceID::TestGetDeviceID() { | 31 std::string TestFlashDRM::TestGetDeviceID() { |
| 30 DeviceID device_id(instance_); | 32 // Test the old C++ wrapper. |
| 31 TestCompletionCallbackWithOutput<Var> output_callback( | 33 // TODO(raymes): Remove this once Flash switches APIs. |
| 32 instance_->pp_instance()); | 34 { |
| 33 int32_t rv = device_id.GetDeviceID(output_callback.GetCallback()); | 35 DeviceID device_id(instance_); |
| 34 output_callback.WaitForResult(rv); | 36 TestCompletionCallbackWithOutput<Var> output_callback( |
| 35 ASSERT_TRUE(output_callback.result() == PP_OK); | 37 instance_->pp_instance()); |
| 36 Var result = output_callback.output(); | 38 int32_t rv = device_id.GetDeviceID(output_callback.GetCallback()); |
| 37 ASSERT_TRUE(result.is_string()); | 39 output_callback.WaitForResult(rv); |
| 38 std::string id = result.AsString(); | 40 ASSERT_TRUE(output_callback.result() == PP_OK); |
| 39 ASSERT_FALSE(id.empty()); | 41 Var result = output_callback.output(); |
| 42 ASSERT_TRUE(result.is_string()); |
| 43 std::string id = result.AsString(); |
| 44 ASSERT_FALSE(id.empty()); |
| 45 } |
| 46 |
| 47 { |
| 48 DRM drm(instance_); |
| 49 TestCompletionCallbackWithOutput<Var> output_callback( |
| 50 instance_->pp_instance()); |
| 51 int32_t rv = drm.GetDeviceID(output_callback.GetCallback()); |
| 52 output_callback.WaitForResult(rv); |
| 53 ASSERT_TRUE(output_callback.result() == PP_OK); |
| 54 Var result = output_callback.output(); |
| 55 ASSERT_TRUE(result.is_string()); |
| 56 std::string id = result.AsString(); |
| 57 ASSERT_FALSE(id.empty()); |
| 58 } |
| 40 | 59 |
| 41 PASS(); | 60 PASS(); |
| 42 } | 61 } |
| OLD | NEW |