blob: 0d00cc3134b4c03edc5e68715ddb2944f189ebe6 [file] [log] [blame]
Brian Carlstrom265091e2013-01-30 14:08:26 -08001/*
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
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -080019#include "common_runtime_test.h"
Brian Carlstrom265091e2013-01-30 14:08:26 -080020
21namespace art {
22
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -080023class DexMethodIteratorTest : public CommonRuntimeTest {
Ian Rogers8d31bbd2013-10-13 10:44:14 -070024};
Brian Carlstrom265091e2013-01-30 14:08:26 -080025
26TEST_F(DexMethodIteratorTest, Basic) {
27 ScopedObjectAccess soa(Thread::Current());
28 std::vector<const DexFile*> dex_files;
Andreas Gampe833a4852014-05-21 18:46:59 -070029 const char* jars[] = { "core-libart", "conscrypt", "okhttp", "core-junit", "bouncycastle" };
30 for (size_t i = 0; i < 5; ++i) {
31 dex_files.push_back(LoadExpectSingleDexFile(GetDexFileName(jars[i]).c_str()));
32 }
Brian Carlstrom265091e2013-01-30 14:08:26 -080033 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