Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Side by Side Diff: ppapi/tests/test_output_protection_private.cc

Issue 24039002: Pepper API implementation for output protection. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: add test Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 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.
4
5 #include "ppapi/tests/test_output_protection_private.h"
6
7 #include "ppapi/tests/testing_instance.h"
8
9 REGISTER_TEST_CASE(OutputProtectionPrivate);
10
11 TestOutputProtectionPrivate::TestOutputProtectionPrivate(
12 TestingInstance* instance)
13 : TestCase(instance) {
14 }
15
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();
22 }
23
24 void TestOutputProtectionPrivate::RunTests(const std::string& filter) {
25 RUN_TEST(QueryStatus, filter);
26 RUN_TEST(EnableProtection, filter);
27 }
28
29 std::string TestOutputProtectionPrivate::TestQueryStatus() {
30 TestCompletionCallback callback(instance_->pp_instance(), callback_type());
31
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 #if defined(OS_CHROMEOS)
43 ASSERT_EQ(PP_OK, callback.result());
44 #else
45 ASSERT_EQ(PP_ERROR_BADRESOURCE, callback.result());
46 #endif
47
48 PASS();
49 }
50
51 std::string TestOutputProtectionPrivate::TestEnableProtection() {
52 TestCompletionCallback callback(instance_->pp_instance(), callback_type());
53
54 PP_Resource output_protection_resource = output_protection_interface_->
55 Create(instance_->pp_instance());
56 callback.WaitForResult(
57 output_protection_interface_->EnableProtection(
58 output_protection_resource,
59 PP_OUTPUT_PROTECTION_METHOD_PRIVATE_NONE,
60 callback.GetCallback().pp_completion_callback()));
61 #if defined(OS_CHROMEOS)
62 ASSERT_EQ(PP_OK, callback.result());
63 #else
64 ASSERT_EQ(PP_ERROR_BADRESOURCE, callback.result());
65 #endif
66
67 PASS();
68 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698