1 /** 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef MOCK_RIL_JS_SUPPORT_H_ 18 #define MOCK_RIL_JS_SUPPORT_H_ 19 20 #include <v8.h> 21 #include <telephony/ril.h> 22 23 // The global value of radio state shared between cpp and js code. 24 extern RIL_RadioState gRadioState; 25 26 // A javascript print function 27 extern v8::Handle<v8::Value> Print(const v8::Arguments& args); 28 29 // Read a file into a array returning the buffer and the size 30 extern int ReadFile(const char *fileName, char** data, size_t *length = NULL); 31 32 // A javascript read file function arg[0] = filename 33 extern v8::Handle<v8::Value> ReadFileToString(const v8::Arguments& args); 34 35 // A javascript read file function arg[0] = filename 36 extern v8::Handle<v8::Value> ReadFileToBuffer(const v8::Arguments& args); 37 38 // make the Java 39 extern v8::Persistent<v8::Context> makeJsContext(); 40 41 // Run a javascript 42 extern void runJs(v8::Handle<v8::Context> context, v8::TryCatch *try_catch, 43 const char *fileName, const char *code); 44 45 // Test this module 46 extern void testJsSupport(v8::Handle<v8::Context> context); 47 48 #endif // MOCK_RIL_JS_SUPPORT_H_ 49