blob: cd8c39096d292e1d7fd043e592f5f2fa902e674a [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
Ian Rogerse63db272014-07-15 15:36:11 -070019#include "base/stl_util.h"
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -080020#include "common_runtime_test.h"
Brian Carlstrom53463ea2014-11-09 14:11:51 -080021#include "oat_file.h"
Mathieu Chartier0795f232016-09-27 18:43:30 -070022#include "scoped_thread_state_change-inl.h"
Ian Rogerse63db272014-07-15 15:36:11 -070023#include "thread-inl.h"
Brian Carlstrom265091e2013-01-30 14:08:26 -080024
25namespace art {
26
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -080027class DexMethodIteratorTest : public CommonRuntimeTest {
Ian Rogers8d31bbd2013-10-13 10:44:14 -070028};
Brian Carlstrom265091e2013-01-30 14:08:26 -080029
30TEST_F(DexMethodIteratorTest, Basic) {
31 ScopedObjectAccess soa(Thread::Current());
32 std::vector<const DexFile*> dex_files;
Brian Carlstrom53463ea2014-11-09 14:11:51 -080033 CHECK_NE(boot_class_path_.size(), 0U);
34 for (size_t i = 0; i < boot_class_path_.size(); ++i) {
35 dex_files.push_back(boot_class_path_[i]);
Andreas Gampe833a4852014-05-21 18:46:59 -070036 }
Brian Carlstrom265091e2013-01-30 14:08:26 -080037 DexMethodIterator it(dex_files);
38 while (it.HasNext()) {
39 const DexFile& dex_file = it.GetDexFile();
40 InvokeType invoke_type = it.GetInvokeType();
41 uint32_t method_idx = it.GetMemberIndex();
Ian Rogerscf7f1912014-10-22 22:06:39 -070042 if ((false)) {
David Sehr709b0702016-10-13 09:12:37 -070043 LOG(INFO) << invoke_type << " " << dex_file.PrettyMethod(method_idx);
Brian Carlstrom265091e2013-01-30 14:08:26 -080044 }
45 it.Next();
46 }
Brian Carlstrom265091e2013-01-30 14:08:26 -080047}
48
49} // namespace art