1049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe/* 2049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe * Copyright (C) 2014 The Android Open Source Project 3049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe * 4049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe * Licensed under the Apache License, Version 2.0 (the "License"); 5049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe * you may not use this file except in compliance with the License. 6049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe * You may obtain a copy of the License at 7049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe * 8049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe * http://www.apache.org/licenses/LICENSE-2.0 9049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe * 10049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe * Unless required by applicable law or agreed to in writing, software 11049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe * distributed under the License is distributed on an "AS IS" BASIS, 12049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe * See the License for the specific language governing permissions and 14049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe * limitations under the License. 15049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe */ 16049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe 17049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe#include "NativeBridgeTest.h" 18049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe 19049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampenamespace android { 20049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe 21049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampestatic const char* kTestName = "../librandom$@-bridge_not.existing.so"; 22049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe 23049249ce7addafaa0bd09480cd8858cd2c54138fAndreas GampeTEST_F(NativeBridgeTest, InvalidChars) { 24049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe // Do one test actually calling setup. 25049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe EXPECT_EQ(false, NativeBridgeError()); 26035bd7541ed909344348b6a4e17a7ef01a434653Andreas Gampe LoadNativeBridge(kTestName, nullptr); 27049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe // This should lead to an error for invalid characters. 28049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe EXPECT_EQ(true, NativeBridgeError()); 29049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe 30049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe // Further tests need to use NativeBridgeNameAcceptable, as the error 31049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe // state can't be changed back. 32049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe EXPECT_EQ(false, NativeBridgeNameAcceptable(".")); 33049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe EXPECT_EQ(false, NativeBridgeNameAcceptable("..")); 34049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe EXPECT_EQ(false, NativeBridgeNameAcceptable("_")); 35049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe EXPECT_EQ(false, NativeBridgeNameAcceptable("-")); 36049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe EXPECT_EQ(false, NativeBridgeNameAcceptable("lib@.so")); 37049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe EXPECT_EQ(false, NativeBridgeNameAcceptable("lib$.so")); 38049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe} 39049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe 40049249ce7addafaa0bd09480cd8858cd2c54138fAndreas Gampe} // namespace android 41