Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 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 | #include "dex_method_iterator.h" |
| 18 | |
| 19 | #include "common_test.h" |
| 20 | |
| 21 | namespace art { |
| 22 | |
| 23 | class DexMethodIteratorTest : public CommonTest {}; |
| 24 | |
| 25 | TEST_F(DexMethodIteratorTest, Basic) { |
| 26 | ScopedObjectAccess soa(Thread::Current()); |
| 27 | std::vector<const DexFile*> dex_files; |
| 28 | dex_files.push_back(DexFile::Open(GetDexFileName("core"), GetDexFileName("core"))); |
Brian Carlstrom | 654d919 | 2013-04-30 18:35:32 -0700 | [diff] [blame] | 29 | dex_files.push_back(DexFile::Open(GetDexFileName("conscrypt"), GetDexFileName("conscrypt"))); |
| 30 | dex_files.push_back(DexFile::Open(GetDexFileName("okhttp"), GetDexFileName("okhttp"))); |
Brian Carlstrom | 265091e | 2013-01-30 14:08:26 -0800 | [diff] [blame] | 31 | dex_files.push_back(DexFile::Open(GetDexFileName("core-junit"), GetDexFileName("core-junit"))); |
| 32 | dex_files.push_back(DexFile::Open(GetDexFileName("bouncycastle"), GetDexFileName("bouncycastle"))); |
| 33 | DexMethodIterator it(dex_files); |
| 34 | while (it.HasNext()) { |
| 35 | const DexFile& dex_file = it.GetDexFile(); |
| 36 | InvokeType invoke_type = it.GetInvokeType(); |
| 37 | uint32_t method_idx = it.GetMemberIndex(); |
| 38 | if (false) { |
| 39 | LG << invoke_type << " " << PrettyMethod(method_idx, dex_file); |
| 40 | } |
| 41 | it.Next(); |
| 42 | } |
| 43 | STLDeleteElements(&dex_files); |
| 44 | } |
| 45 | |
| 46 | } // namespace art |