summaryrefslogtreecommitdiff
path: root/runtime/class_linker_test.cc
diff options
context:
space:
mode:
author Calin Juravle <calin@google.com> 2017-06-28 11:03:12 -0700
committer Calin Juravle <calin@google.com> 2017-07-06 12:05:54 -0700
commit7865ac7e233b8a8dcfd6ca8466d30b39a8089c3e (patch)
treec845ef2149d819dd512b87f1898aff6d583f91c6 /runtime/class_linker_test.cc
parent415dc3d63fc05f89b77c2f6249a5a89dade4df27 (diff)
Add DelegateLastClassLoader to the list of WellKnownClassLoaders
Generalize CreatePathClassLoader from the class linker to be able to create a well known class loader with a given parent. For now, it only supports PathClassLoader and DelegateLastClassLoader. Test: m test-art-host Bug: 38138251 Change-Id: Iced0de7c21010c6d61dbf29a631e670011833a7d
Diffstat (limited to 'runtime/class_linker_test.cc')
-rw-r--r--runtime/class_linker_test.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc
index 684a261cca..6f0691795f 100644
--- a/runtime/class_linker_test.cc
+++ b/runtime/class_linker_test.cc
@@ -1533,4 +1533,15 @@ TEST_F(ClassLinkerMethodHandlesTest, TestResolveMethodTypes) {
ASSERT_TRUE(method1_type.Get() != method2_type.Get());
}
+// Verify that ClassLinker's CreateWellknownClassLoader works as expected
+// by creating a chain of class loaders with various dex files.
+TEST_F(ClassLinkerTest, CreateWellKnownClassLoader) {
+ // LoadDexIn*ClassLoader methods already assert that the parent loader is the expected one.
+ // No need to check again.
+ jobject class_loader_a = LoadDexInPathClassLoader("MyClass", nullptr);
+ jobject class_loader_b = LoadDexInDelegateLastClassLoader("Nested", class_loader_a);
+ jobject class_loader_c = LoadDexInPathClassLoader("MultiDex", class_loader_b);
+ LoadDexInDelegateLastClassLoader("Interfaces", class_loader_c);
+}
+
} // namespace art