diff options
author | mseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-25 00:54:12 +0000 |
---|---|---|
committer | mseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-25 00:54:12 +0000 |
commit | f711b335c736dc9233f3350a36d8d510945b5df4 (patch) | |
tree | 51421a5fc2502fc8ad91c4f285553f3d787acd11 /ppapi | |
parent | 0714e9e0fbf563159a4e0f69cde0a4c6dfc653f5 (diff) | |
download | chromium_src-f711b335c736dc9233f3350a36d8d510945b5df4.zip chromium_src-f711b335c736dc9233f3350a36d8d510945b5df4.tar.gz chromium_src-f711b335c736dc9233f3350a36d8d510945b5df4.tar.bz2 |
NaCl: Remove unused dylib_unittest.cc and plugin_unittest.cc
These files were only referenced from build.scons files, which were
removed in r160748.
This test was testing the NaCl PPAPI plugin as a standalone plugin,
which we no longer support.
BUG=154400
TEST=trybots
Review URL: https://codereview.chromium.org/11270021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163976 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
3 files changed, 0 insertions, 140 deletions
diff --git a/ppapi/native_client/src/trusted/plugin/dylib_unittest.cc b/ppapi/native_client/src/trusted/plugin/dylib_unittest.cc deleted file mode 100644 index eff9816..0000000 --- a/ppapi/native_client/src/trusted/plugin/dylib_unittest.cc +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "native_client/src/trusted/plugin/dylib_unittest.h" - -#include <stdio.h> - -#if NACL_WINDOWS -DylibHandle DylibOpen(const char* lib_path) { - return LoadLibrary(lib_path); -} - -bool DylibClose(DylibHandle dl_handle) { - return FreeLibrary(dl_handle) == TRUE; -} - -SymbolHandle GetSymbolHandle(DylibHandle dl_handle, const char* name) { - return reinterpret_cast<SymbolHandle>(GetProcAddress(dl_handle, name)); -} -#else -DylibHandle DylibOpen(const char* lib_path) { - // By using RTLD_NOW we check that all symbols are resolved before the - // dlopen completes, or it fails. - return dlopen(lib_path, RTLD_NOW | RTLD_LOCAL); -} - -bool DylibClose(DylibHandle dl_handle) { - return dlclose(dl_handle) == 0; -} - -SymbolHandle GetSymbolHandle(DylibHandle dl_handle, const char* name) { - void* sym_handle = dlsym(dl_handle, name); - char* error_string = dlerror(); - if (sym_handle == NULL || error_string != NULL) { - fprintf(stderr, "Couldn't get symbol %s: %s\n", name, error_string); - sym_handle = NULL; - } - return reinterpret_cast<SymbolHandle>(sym_handle); -} -#endif diff --git a/ppapi/native_client/src/trusted/plugin/dylib_unittest.h b/ppapi/native_client/src/trusted/plugin/dylib_unittest.h deleted file mode 100644 index 2c4f8a2c..0000000 --- a/ppapi/native_client/src/trusted/plugin/dylib_unittest.h +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Functions for dynamically loading the trusted plugin when running unit -// tests. - -#ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_DYLIB_UNITTEST_H_ -#define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_DYLIB_UNITTEST_H_ - -#if NACL_WINDOWS -#include <windows.h> -typedef HINSTANCE DylibHandle; -typedef void (*SymbolHandle)(); -#else -#include <dlfcn.h> -#include <inttypes.h> -typedef void* DylibHandle; -// uintptr_t is used here because ISO C++ won't allow casting from a void* -// (the return type of dlsym()) to a pointer-to-function. Instead, -// GetSymbolHandle() returns a uintptr_t which can then be cast into a pointer- -// to-function. This depends on uintptr_t being the same size (or larger than) -// void*. -typedef uintptr_t SymbolHandle; -#endif - -// Load the dynamic library at |lib_path|. Returns NULL on error. -DylibHandle DylibOpen(const char* lib_path); - -// Close the dynamic library and free all the system resources associated with -// it. Returns |true| on success. -bool DylibClose(DylibHandle dl_handle); - -// Return a handle to the symbol named |name| in the library represented by -// |dl_handle|. Returns NULL ff the symbol does not exist, or some other error -// occurs. -SymbolHandle GetSymbolHandle(DylibHandle dl_handle, const char* name); - -#endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_DYLIB_UNITTEST_H_ diff --git a/ppapi/native_client/src/trusted/plugin/plugin_unittest.cc b/ppapi/native_client/src/trusted/plugin/plugin_unittest.cc deleted file mode 100644 index 27e2c02..0000000 --- a/ppapi/native_client/src/trusted/plugin/plugin_unittest.cc +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Unit tests for ppGoogleNaClPlugin - -#include <stdio.h> - -#include "native_client/src/include/nacl_string.h" -#include "native_client/src/trusted/plugin/nexe_arch.h" -#include "native_client/src/trusted/plugin/dylib_unittest.h" - -// Verify that the ISA string returned by the plugin is the correct one for -// this platform. -bool TestGetNexeArch(DylibHandle dl_handle, const nacl::string& expected_isa) { - typedef const char* (*GetSandboxISAFunc)(); - GetSandboxISAFunc get_sandbox_isa_sym = reinterpret_cast<GetSandboxISAFunc>( - GetSymbolHandle(dl_handle, "NaClPluginGetSandboxISA")); - if (get_sandbox_isa_sym == NULL) - return false; - nacl::string sandbox_isa(get_sandbox_isa_sym()); - if (sandbox_isa != expected_isa) { - fprintf(stderr, "TestGetNexeArch ERROR: expeced ISA %s, got %s\n", - expected_isa.c_str(), sandbox_isa.c_str()); - return false; - } - return true; -} - -int main(int argc, char** argv) { - DylibHandle dl_handle = NULL; - - if (3 != argc) { - fprintf(stderr, "Usage: %s <plugin_name> <ISA_string>\n", argv[0]); - return 1; - } - // Test opening the dynamic library - dl_handle = DylibOpen(argv[1]); - if (NULL == dl_handle) { - fprintf(stderr, "Couldn't open: %s\n", argv[1]); - return 1; - } - - // Exercise some bare minimum functionality for PPAPI plugins. - bool success = TestGetNexeArch(dl_handle, argv[2]); - - // Test closing the dynamic library - if (!DylibClose(dl_handle)) { - fprintf(stderr, "Couldn't close: %s\n", argv[1]); - return 1; - } - - if (success) { - printf("PASS\n"); - return 0; - } else { - printf("FAIL\n"); - return 1; - } -} |