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

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

Issue 13820003: Pepper: Autogenerate thunk for PPB_TrueTypeFont. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: nit comment in gamepad for presubmit Created 7 years, 8 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
« no previous file with comments | « ppapi/proxy/resource_creation_proxy.cc ('k') | ppapi/thunk/ppb_truetype_font_dev_thunk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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 // Tests PPB_TrueTypeFont interface. 5 // Tests PPB_TrueTypeFont interface.
6 6
7 #include "ppapi/tests/test_truetype_font.h" 7 #include "ppapi/tests/test_truetype_font.h"
8 8
9 #include <stdio.h>
9 #include <string.h> 10 #include <string.h>
10 #include <algorithm> 11 #include <algorithm>
11 #include <limits> 12 #include <limits>
12 13
13 #include "ppapi/c/dev/ppb_testing_dev.h" 14 #include "ppapi/c/dev/ppb_testing_dev.h"
14 #include "ppapi/cpp/completion_callback.h" 15 #include "ppapi/cpp/completion_callback.h"
15 #include "ppapi/cpp/dev/truetype_font_dev.h" 16 #include "ppapi/cpp/dev/truetype_font_dev.h"
16 #include "ppapi/cpp/instance.h" 17 #include "ppapi/cpp/instance.h"
17 #include "ppapi/cpp/var.h" 18 #include "ppapi/cpp/var.h"
18 #include "ppapi/tests/test_utils.h" 19 #include "ppapi/tests/test_utils.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 108 }
108 { 109 {
109 // Using an invalid instance should fail. 110 // Using an invalid instance should fail.
110 TestCompletionCallbackWithOutput< std::vector<pp::Var> > cc( 111 TestCompletionCallbackWithOutput< std::vector<pp::Var> > cc(
111 instance_->pp_instance(), false); 112 instance_->pp_instance(), false);
112 cc.WaitForResult( 113 cc.WaitForResult(
113 ppb_truetype_font_interface_->GetFontFamilies( 114 ppb_truetype_font_interface_->GetFontFamilies(
114 kInvalidInstance, 115 kInvalidInstance,
115 cc.GetCallback().output(), 116 cc.GetCallback().output(),
116 cc.GetCallback().pp_completion_callback())); 117 cc.GetCallback().pp_completion_callback()));
117 ASSERT_EQ(PP_ERROR_FAILED, cc.result()); 118 ASSERT_TRUE(cc.result() == PP_ERROR_FAILED ||
119 cc.result() == PP_ERROR_BADARGUMENT);
118 ASSERT_EQ(0, cc.output().size()); 120 ASSERT_EQ(0, cc.output().size());
119 } 121 }
120 122
121 PASS(); 123 PASS();
122 } 124 }
123 125
124 std::string TestTrueTypeFont::TestCreate() { 126 std::string TestTrueTypeFont::TestCreate() {
125 PP_Resource font; 127 PP_Resource font;
126 PP_TrueTypeFontDesc_Dev desc = { 128 PP_TrueTypeFontDesc_Dev desc = {
127 PP_MakeUndefined(), 129 PP_MakeUndefined(),
128 PP_TRUETYPEFONTFAMILY_SERIF, 130 PP_TRUETYPEFONTFAMILY_SERIF,
129 PP_TRUETYPEFONTSTYLE_NORMAL, 131 PP_TRUETYPEFONTSTYLE_NORMAL,
130 PP_TRUETYPEFONTWEIGHT_NORMAL, 132 PP_TRUETYPEFONTWEIGHT_NORMAL,
131 PP_TRUETYPEFONTWIDTH_NORMAL, 133 PP_TRUETYPEFONTWIDTH_NORMAL,
132 PP_TRUETYPEFONTCHARSET_DEFAULT 134 PP_TRUETYPEFONTCHARSET_DEFAULT
133 }; 135 };
134 // Creating a font from an invalid instance returns an invalid resource. 136 // Creating a font from an invalid instance returns an invalid resource.
135 font = ppb_truetype_font_interface_->Create(kInvalidInstance, &desc); 137 font = ppb_truetype_font_interface_->Create(kInvalidInstance, &desc);
136 ASSERT_EQ(kInvalidResource, font); 138 ASSERT_EQ(kInvalidResource, font);
137 ASSERT_NE(PP_TRUE, ppb_truetype_font_interface_->IsFont(font)); 139 ASSERT_NE(PP_TRUE, ppb_truetype_font_interface_->IsTrueTypeFont(font));
138 140
139 // Creating a font from a valid instance returns a font resource. 141 // Creating a font from a valid instance returns a font resource.
140 font = ppb_truetype_font_interface_->Create(instance_->pp_instance(), &desc); 142 font = ppb_truetype_font_interface_->Create(instance_->pp_instance(), &desc);
141 ASSERT_NE(kInvalidResource, font); 143 ASSERT_NE(kInvalidResource, font);
142 ASSERT_EQ(PP_TRUE, ppb_truetype_font_interface_->IsFont(font)); 144 ASSERT_EQ(PP_TRUE, ppb_truetype_font_interface_->IsTrueTypeFont(font));
143 145
144 ppb_core_interface_->ReleaseResource(font); 146 ppb_core_interface_->ReleaseResource(font);
145 // Once released, the resource shouldn't be a font. 147 // Once released, the resource shouldn't be a font.
146 ASSERT_NE(PP_TRUE, ppb_truetype_font_interface_->IsFont(font)); 148 ASSERT_NE(PP_TRUE, ppb_truetype_font_interface_->IsTrueTypeFont(font));
147 149
148 PASS(); 150 PASS();
149 } 151 }
150 152
151 std::string TestTrueTypeFont::TestDescribe() { 153 std::string TestTrueTypeFont::TestDescribe() {
152 pp::TrueTypeFontDesc_Dev create_desc; 154 pp::TrueTypeFontDesc_Dev create_desc;
153 create_desc.set_generic_family(PP_TRUETYPEFONTFAMILY_SERIF); 155 create_desc.set_generic_family(PP_TRUETYPEFONTFAMILY_SERIF);
154 create_desc.set_style(PP_TRUETYPEFONTSTYLE_NORMAL); 156 create_desc.set_style(PP_TRUETYPEFONTSTYLE_NORMAL);
155 create_desc.set_weight(PP_TRUETYPEFONTWEIGHT_NORMAL); 157 create_desc.set_weight(PP_TRUETYPEFONTWEIGHT_NORMAL);
156 pp::TrueTypeFont_Dev font(instance_, create_desc); 158 pp::TrueTypeFont_Dev font(instance_, create_desc);
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 instance_->pp_instance(), false); 359 instance_->pp_instance(), false);
358 cc.WaitForResult(font.GetTable(MAKE_TABLE_TAG('c', 'm', 'a', 'p'), 360 cc.WaitForResult(font.GetTable(MAKE_TABLE_TAG('c', 'm', 'a', 'p'),
359 0, -100, 361 0, -100,
360 cc.GetCallback())); 362 cc.GetCallback()));
361 ASSERT_EQ(PP_ERROR_BADARGUMENT, cc.result()); 363 ASSERT_EQ(PP_ERROR_BADARGUMENT, cc.result());
362 ASSERT_EQ(0, cc.output().size()); 364 ASSERT_EQ(0, cc.output().size());
363 } 365 }
364 366
365 PASS(); 367 PASS();
366 } 368 }
OLDNEW
« no previous file with comments | « ppapi/proxy/resource_creation_proxy.cc ('k') | ppapi/thunk/ppb_truetype_font_dev_thunk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698