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

Side by Side Diff: media/mojo/clients/mojo_cdm_unittest.cc

Issue 2568463003: media: Rename MediaKeys to ContentDecryptionModule (Closed)
Patch Set: Created 4 years 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 base::RunLoop().RunUntilIdle(); 71 base::RunLoop().RunUntilIdle();
72 72
73 if (expected_result == SUCCESS) { 73 if (expected_result == SUCCESS) {
74 EXPECT_TRUE(mojo_cdm_); 74 EXPECT_TRUE(mojo_cdm_);
75 } else { 75 } else {
76 EXPECT_FALSE(mojo_cdm_); 76 EXPECT_FALSE(mojo_cdm_);
77 } 77 }
78 } 78 }
79 79
80 void OnCdmCreated(ExpectedResult expected_result, 80 void OnCdmCreated(ExpectedResult expected_result,
81 const scoped_refptr<MediaKeys>& cdm, 81 const scoped_refptr<ContentDecryptionModule>& cdm,
jrummell 2016/12/12 22:08:40 nit; Should probably include content_decryption_mo
xhwang 2016/12/12 22:32:51 Done.
82 const std::string& error_message) { 82 const std::string& error_message) {
83 if (!cdm) { 83 if (!cdm) {
84 DVLOG(1) << error_message; 84 DVLOG(1) << error_message;
85 return; 85 return;
86 } 86 }
87 87
88 EXPECT_EQ(SUCCESS, expected_result); 88 EXPECT_EQ(SUCCESS, expected_result);
89 mojo_cdm_ = cdm; 89 mojo_cdm_ = cdm;
90 } 90 }
91 91
92 // Fixture members. 92 // Fixture members.
93 base::TestMessageLoop message_loop_; 93 base::TestMessageLoop message_loop_;
94 94
95 MojoCdmServiceContext mojo_cdm_service_context_; 95 MojoCdmServiceContext mojo_cdm_service_context_;
96 StrictMock<MockCdmClient> cdm_client_; 96 StrictMock<MockCdmClient> cdm_client_;
97 97
98 // TODO(jrummell): Use a MockCdmFactory to create a MockCdm here for more test 98 // TODO(jrummell): Use a MockCdmFactory to create a MockCdm here for more test
99 // coverage. 99 // coverage.
100 DefaultCdmFactory cdm_factory_; 100 DefaultCdmFactory cdm_factory_;
101 101
102 std::unique_ptr<MojoCdmService> mojo_cdm_service_; 102 std::unique_ptr<MojoCdmService> mojo_cdm_service_;
103 mojo::Binding<mojom::ContentDecryptionModule> cdm_binding_; 103 mojo::Binding<mojom::ContentDecryptionModule> cdm_binding_;
104 scoped_refptr<MediaKeys> mojo_cdm_; 104 scoped_refptr<ContentDecryptionModule> mojo_cdm_;
105 105
106 private: 106 private:
107 DISALLOW_COPY_AND_ASSIGN(MojoCdmTest); 107 DISALLOW_COPY_AND_ASSIGN(MojoCdmTest);
108 }; 108 };
109 109
110 TEST_F(MojoCdmTest, Create_Success) { 110 TEST_F(MojoCdmTest, Create_Success) {
111 Initialize(SUCCESS); 111 Initialize(SUCCESS);
112 } 112 }
113 113
114 TEST_F(MojoCdmTest, Create_ConnectionError) { 114 TEST_F(MojoCdmTest, Create_ConnectionError) {
115 Initialize(CONNECTION_ERROR); 115 Initialize(CONNECTION_ERROR);
116 } 116 }
117 117
118 // TODO(xhwang): Add more test cases! 118 // TODO(xhwang): Add more test cases!
119 119
120 } // namespace media 120 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698