dex_method_iterator_test.cc revision 833a48501d560c9fa7fc78ef619888138c2d374f
1265091e581c9f643b37e7966890911f09e223269Brian Carlstrom/* 2265091e581c9f643b37e7966890911f09e223269Brian Carlstrom * Copyright (C) 2011 The Android Open Source Project 3265091e581c9f643b37e7966890911f09e223269Brian Carlstrom * 4265091e581c9f643b37e7966890911f09e223269Brian Carlstrom * Licensed under the Apache License, Version 2.0 (the "License"); 5265091e581c9f643b37e7966890911f09e223269Brian Carlstrom * you may not use this file except in compliance with the License. 6265091e581c9f643b37e7966890911f09e223269Brian Carlstrom * You may obtain a copy of the License at 7265091e581c9f643b37e7966890911f09e223269Brian Carlstrom * 8265091e581c9f643b37e7966890911f09e223269Brian Carlstrom * http://www.apache.org/licenses/LICENSE-2.0 9265091e581c9f643b37e7966890911f09e223269Brian Carlstrom * 10265091e581c9f643b37e7966890911f09e223269Brian Carlstrom * Unless required by applicable law or agreed to in writing, software 11265091e581c9f643b37e7966890911f09e223269Brian Carlstrom * distributed under the License is distributed on an "AS IS" BASIS, 12265091e581c9f643b37e7966890911f09e223269Brian Carlstrom * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13265091e581c9f643b37e7966890911f09e223269Brian Carlstrom * See the License for the specific language governing permissions and 14265091e581c9f643b37e7966890911f09e223269Brian Carlstrom * limitations under the License. 15265091e581c9f643b37e7966890911f09e223269Brian Carlstrom */ 16265091e581c9f643b37e7966890911f09e223269Brian Carlstrom 17265091e581c9f643b37e7966890911f09e223269Brian Carlstrom#include "dex_method_iterator.h" 18265091e581c9f643b37e7966890911f09e223269Brian Carlstrom 19a1ce1fef2d49d1d537776a5308ace7102a815fe5Brian Carlstrom#include "common_runtime_test.h" 20265091e581c9f643b37e7966890911f09e223269Brian Carlstrom 21265091e581c9f643b37e7966890911f09e223269Brian Carlstromnamespace art { 22265091e581c9f643b37e7966890911f09e223269Brian Carlstrom 23a1ce1fef2d49d1d537776a5308ace7102a815fe5Brian Carlstromclass DexMethodIteratorTest : public CommonRuntimeTest { 248d31bbd3d6536de12bc20e3d29cfe03fe848f9daIan Rogers}; 25265091e581c9f643b37e7966890911f09e223269Brian Carlstrom 26265091e581c9f643b37e7966890911f09e223269Brian CarlstromTEST_F(DexMethodIteratorTest, Basic) { 27265091e581c9f643b37e7966890911f09e223269Brian Carlstrom ScopedObjectAccess soa(Thread::Current()); 28265091e581c9f643b37e7966890911f09e223269Brian Carlstrom std::vector<const DexFile*> dex_files; 29833a48501d560c9fa7fc78ef619888138c2d374fAndreas Gampe const char* jars[] = { "core-libart", "conscrypt", "okhttp", "core-junit", "bouncycastle" }; 30833a48501d560c9fa7fc78ef619888138c2d374fAndreas Gampe for (size_t i = 0; i < 5; ++i) { 31833a48501d560c9fa7fc78ef619888138c2d374fAndreas Gampe dex_files.push_back(LoadExpectSingleDexFile(GetDexFileName(jars[i]).c_str())); 32833a48501d560c9fa7fc78ef619888138c2d374fAndreas Gampe } 33265091e581c9f643b37e7966890911f09e223269Brian Carlstrom DexMethodIterator it(dex_files); 34265091e581c9f643b37e7966890911f09e223269Brian Carlstrom while (it.HasNext()) { 35265091e581c9f643b37e7966890911f09e223269Brian Carlstrom const DexFile& dex_file = it.GetDexFile(); 36265091e581c9f643b37e7966890911f09e223269Brian Carlstrom InvokeType invoke_type = it.GetInvokeType(); 37265091e581c9f643b37e7966890911f09e223269Brian Carlstrom uint32_t method_idx = it.GetMemberIndex(); 38265091e581c9f643b37e7966890911f09e223269Brian Carlstrom if (false) { 39265091e581c9f643b37e7966890911f09e223269Brian Carlstrom LG << invoke_type << " " << PrettyMethod(method_idx, dex_file); 40265091e581c9f643b37e7966890911f09e223269Brian Carlstrom } 41265091e581c9f643b37e7966890911f09e223269Brian Carlstrom it.Next(); 42265091e581c9f643b37e7966890911f09e223269Brian Carlstrom } 43265091e581c9f643b37e7966890911f09e223269Brian Carlstrom STLDeleteElements(&dex_files); 44265091e581c9f643b37e7966890911f09e223269Brian Carlstrom} 45265091e581c9f643b37e7966890911f09e223269Brian Carlstrom 46265091e581c9f643b37e7966890911f09e223269Brian Carlstrom} // namespace art 47