| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "ppapi/tests/test_var_resource.h" | 5 #include "ppapi/tests/test_var_resource.h" |
| 6 | 6 |
| 7 #include "ppapi/c/pp_resource.h" | 7 #include "ppapi/c/pp_resource.h" |
| 8 #include "ppapi/c/pp_var.h" | 8 #include "ppapi/c/pp_var.h" |
| 9 #include "ppapi/cpp/instance.h" | 9 #include "ppapi/cpp/instance.h" |
| 10 #include "ppapi/cpp/module.h" | 10 #include "ppapi/cpp/module.h" |
| 11 #include "ppapi/tests/testing_instance.h" | 11 #include "ppapi/tests/testing_instance.h" |
| 12 | 12 |
| 13 REGISTER_TEST_CASE(VarResource); | 13 REGISTER_TEST_CASE(VarResource); |
| 14 | 14 |
| 15 bool TestVarResource::Init() { | 15 bool TestVarResource::Init() { |
| 16 core_interface_ = static_cast<const PPB_Core*>( | 16 core_interface_ = static_cast<const PPB_Core*>( |
| 17 pp::Module::Get()->GetBrowserInterface(PPB_CORE_INTERFACE)); | 17 pp::Module::Get()->GetBrowserInterface(PPB_CORE_INTERFACE)); |
| 18 file_system_interface_ = static_cast<const PPB_FileSystem*>( | 18 file_system_interface_ = static_cast<const PPB_FileSystem*>( |
| 19 pp::Module::Get()->GetBrowserInterface(PPB_FILESYSTEM_INTERFACE)); | 19 pp::Module::Get()->GetBrowserInterface(PPB_FILESYSTEM_INTERFACE)); |
| 20 var_interface_ = static_cast<const PPB_Var*>( | 20 var_interface_ = static_cast<const PPB_Var*>( |
| 21 pp::Module::Get()->GetBrowserInterface(PPB_VAR_INTERFACE)); | 21 pp::Module::Get()->GetBrowserInterface(PPB_VAR_INTERFACE)); |
| 22 var_resource_interface_ = static_cast<const PPB_VarResource_Dev*>( | 22 var_resource_interface_ = static_cast<const PPB_VarResource*>( |
| 23 pp::Module::Get()->GetBrowserInterface(PPB_VAR_RESOURCE_DEV_INTERFACE)); | 23 pp::Module::Get()->GetBrowserInterface(PPB_VAR_RESOURCE_INTERFACE)); |
| 24 return core_interface_ && file_system_interface_ && var_interface_ && | 24 return core_interface_ && file_system_interface_ && var_interface_ && |
| 25 var_resource_interface_ && CheckTestingInterface(); | 25 var_resource_interface_ && CheckTestingInterface(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void TestVarResource::RunTests(const std::string& filter) { | 28 void TestVarResource::RunTests(const std::string& filter) { |
| 29 RUN_TEST(BasicResource, filter); | 29 RUN_TEST(BasicResource, filter); |
| 30 RUN_TEST(InvalidAndEmpty, filter); | 30 RUN_TEST(InvalidAndEmpty, filter); |
| 31 RUN_TEST(WrongType, filter); | 31 RUN_TEST(WrongType, filter); |
| 32 } | 32 } |
| 33 | 33 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 ASSERT_EQ(0, result); | 126 ASSERT_EQ(0, result); |
| 127 | 127 |
| 128 result = var_resource_interface_->VarToResource(PP_MakeInt32(42)); | 128 result = var_resource_interface_->VarToResource(PP_MakeInt32(42)); |
| 129 ASSERT_EQ(0, result); | 129 ASSERT_EQ(0, result); |
| 130 | 130 |
| 131 result = var_resource_interface_->VarToResource(PP_MakeDouble(1.0)); | 131 result = var_resource_interface_->VarToResource(PP_MakeDouble(1.0)); |
| 132 ASSERT_EQ(0, result); | 132 ASSERT_EQ(0, result); |
| 133 | 133 |
| 134 PASS(); | 134 PASS(); |
| 135 } | 135 } |
| OLD | NEW |