Update V8 to version 4.7.21.
[chromium-blink-merge.git] / ppapi / tests / test_output_protection_private.cc
blob49a44aed11c9e332c1d0b6147215b920407b87e1
1 // Copyright 2013 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.
5 #include "ppapi/tests/test_output_protection_private.h"
7 #include "ppapi/tests/testing_instance.h"
9 REGISTER_TEST_CASE(OutputProtectionPrivate);
11 TestOutputProtectionPrivate::TestOutputProtectionPrivate(
12 TestingInstance* instance)
13 : TestCase(instance) {
16 bool TestOutputProtectionPrivate::Init() {
17 output_protection_interface_ =
18 static_cast<const PPB_OutputProtection_Private*>(
19 pp::Module::Get()->GetBrowserInterface(
20 PPB_OUTPUTPROTECTION_PRIVATE_INTERFACE_0_1));
21 return output_protection_interface_ && CheckTestingInterface();
24 void TestOutputProtectionPrivate::RunTests(const std::string& filter) {
25 RUN_TEST(QueryStatus, filter);
26 RUN_TEST(EnableProtection, filter);
29 std::string TestOutputProtectionPrivate::TestQueryStatus() {
30 TestCompletionCallback callback(instance_->pp_instance(), callback_type());
32 PP_Resource output_protection_resource = output_protection_interface_->
33 Create(instance_->pp_instance());
34 uint32_t link_mask;
35 uint32_t protection_mask;
36 callback.WaitForResult(
37 output_protection_interface_->QueryStatus(
38 output_protection_resource,
39 &link_mask,
40 &protection_mask,
41 callback.GetCallback().pp_completion_callback()));
42 CHECK_CALLBACK_BEHAVIOR(callback);
44 PASS();
47 std::string TestOutputProtectionPrivate::TestEnableProtection() {
48 TestCompletionCallback callback(instance_->pp_instance(), callback_type());
50 PP_Resource output_protection_resource = output_protection_interface_->
51 Create(instance_->pp_instance());
52 callback.WaitForResult(
53 output_protection_interface_->EnableProtection(
54 output_protection_resource,
55 PP_OUTPUT_PROTECTION_METHOD_PRIVATE_NONE,
56 callback.GetCallback().pp_completion_callback()));
57 CHECK_CALLBACK_BEHAVIOR(callback);
59 PASS();