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

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

Issue 8536031: Reland http://codereview.chromium.org/8477015 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge AGAIN Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « ppapi/tests/test_var.h ('k') | ppapi/tests/test_var_deprecated.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_var.h" 5 #include "ppapi/tests/test_var.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 13 matching lines...) Expand all
24 } // namespace 24 } // namespace
25 25
26 REGISTER_TEST_CASE(Var); 26 REGISTER_TEST_CASE(Var);
27 27
28 bool TestVar::Init() { 28 bool TestVar::Init() {
29 var_interface_ = reinterpret_cast<const PPB_Var*>( 29 var_interface_ = reinterpret_cast<const PPB_Var*>(
30 pp::Module::Get()->GetBrowserInterface(PPB_VAR_INTERFACE)); 30 pp::Module::Get()->GetBrowserInterface(PPB_VAR_INTERFACE));
31 return var_interface_ && InitTestingInterface(); 31 return var_interface_ && InitTestingInterface();
32 } 32 }
33 33
34 void TestVar::RunTest() { 34 void TestVar::RunTests(const std::string& filter) {
35 RUN_TEST(BasicString); 35 RUN_TEST(BasicString, filter);
36 RUN_TEST(InvalidAndEmpty); 36 RUN_TEST(InvalidAndEmpty, filter);
37 RUN_TEST(InvalidUtf8); 37 RUN_TEST(InvalidUtf8, filter);
38 RUN_TEST(NullInputInUtf8Conversion); 38 RUN_TEST(NullInputInUtf8Conversion, filter);
39 RUN_TEST(ValidUtf8); 39 RUN_TEST(ValidUtf8, filter);
40 RUN_TEST(Utf8WithEmbeddedNulls); 40 RUN_TEST(Utf8WithEmbeddedNulls, filter);
41 RUN_TEST(VarToUtf8ForWrongType); 41 RUN_TEST(VarToUtf8ForWrongType, filter);
42 } 42 }
43 43
44 std::string TestVar::TestBasicString() { 44 std::string TestVar::TestBasicString() {
45 uint32_t before_object = testing_interface_->GetLiveObjectsForInstance( 45 uint32_t before_object = testing_interface_->GetLiveObjectsForInstance(
46 instance_->pp_instance()); 46 instance_->pp_instance());
47 { 47 {
48 const char kStr[] = "Hello"; 48 const char kStr[] = "Hello";
49 const uint32_t kStrLen(arraysize(kStr) - 1); 49 const uint32_t kStrLen(arraysize(kStr) - 1);
50 PP_Var str = var_interface_->VarFromUtf8(pp::Module::Get()->pp_module(), 50 PP_Var str = var_interface_->VarFromUtf8(pp::Module::Get()->pp_module(),
51 kStr, kStrLen); 51 kStr, kStrLen);
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 if (length != 0) { 245 if (length != 0) {
246 return "Expected 0 on string conversion from Double var."; 246 return "Expected 0 on string conversion from Double var.";
247 } 247 }
248 if (result != NULL) { 248 if (result != NULL) {
249 return "Expected NULL on string conversion from Double var."; 249 return "Expected NULL on string conversion from Double var.";
250 } 250 }
251 251
252 PASS(); 252 PASS();
253 } 253 }
254 254
OLDNEW
« no previous file with comments | « ppapi/tests/test_var.h ('k') | ppapi/tests/test_var_deprecated.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698