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 19e63db27db913f1a88e2095a1ee8239b2bb9124e8Ian Rogers#include "base/stl_util.h" 20a1ce1fef2d49d1d537776a5308ace7102a815fe5Brian Carlstrom#include "common_runtime_test.h" 2153463ea90640c417a6109c7fd987ec3f2e97b52fBrian Carlstrom#include "oat_file.h" 22e63db27db913f1a88e2095a1ee8239b2bb9124e8Ian Rogers#include "scoped_thread_state_change.h" 23e63db27db913f1a88e2095a1ee8239b2bb9124e8Ian Rogers#include "thread-inl.h" 24265091e581c9f643b37e7966890911f09e223269Brian Carlstrom 25265091e581c9f643b37e7966890911f09e223269Brian Carlstromnamespace art { 26265091e581c9f643b37e7966890911f09e223269Brian Carlstrom 27a1ce1fef2d49d1d537776a5308ace7102a815fe5Brian Carlstromclass DexMethodIteratorTest : public CommonRuntimeTest { 288d31bbd3d6536de12bc20e3d29cfe03fe848f9daIan Rogers}; 29265091e581c9f643b37e7966890911f09e223269Brian Carlstrom 30265091e581c9f643b37e7966890911f09e223269Brian CarlstromTEST_F(DexMethodIteratorTest, Basic) { 31265091e581c9f643b37e7966890911f09e223269Brian Carlstrom ScopedObjectAccess soa(Thread::Current()); 32265091e581c9f643b37e7966890911f09e223269Brian Carlstrom std::vector<const DexFile*> dex_files; 3353463ea90640c417a6109c7fd987ec3f2e97b52fBrian Carlstrom CHECK_NE(boot_class_path_.size(), 0U); 3453463ea90640c417a6109c7fd987ec3f2e97b52fBrian Carlstrom for (size_t i = 0; i < boot_class_path_.size(); ++i) { 3553463ea90640c417a6109c7fd987ec3f2e97b52fBrian Carlstrom dex_files.push_back(boot_class_path_[i]); 36833a48501d560c9fa7fc78ef619888138c2d374fAndreas Gampe } 37265091e581c9f643b37e7966890911f09e223269Brian Carlstrom DexMethodIterator it(dex_files); 38265091e581c9f643b37e7966890911f09e223269Brian Carlstrom while (it.HasNext()) { 39265091e581c9f643b37e7966890911f09e223269Brian Carlstrom const DexFile& dex_file = it.GetDexFile(); 40265091e581c9f643b37e7966890911f09e223269Brian Carlstrom InvokeType invoke_type = it.GetInvokeType(); 41265091e581c9f643b37e7966890911f09e223269Brian Carlstrom uint32_t method_idx = it.GetMemberIndex(); 42cf7f19135f0e273f7b0136315633c2abfc715343Ian Rogers if ((false)) { 43c7dd295a4e0cc1d15c0c96088e55a85389bade74Ian Rogers LOG(INFO) << invoke_type << " " << PrettyMethod(method_idx, dex_file); 44265091e581c9f643b37e7966890911f09e223269Brian Carlstrom } 45265091e581c9f643b37e7966890911f09e223269Brian Carlstrom it.Next(); 46265091e581c9f643b37e7966890911f09e223269Brian Carlstrom } 47265091e581c9f643b37e7966890911f09e223269Brian Carlstrom} 48265091e581c9f643b37e7966890911f09e223269Brian Carlstrom 49265091e581c9f643b37e7966890911f09e223269Brian Carlstrom} // namespace art 50