| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |