| // Copyright 2011 Google Inc. All Rights Reserved. |
| |
| #include "src/class_linker.h" |
| #include "src/dex_file.h" |
| #include "gtest/gtest.h" |
| |
| namespace art { |
| |
| static const char kMyClassDex[] = |
| "ZGV4CjAzNQDyNgSqujckc8oAvOKGLvz3+wrLfW9ED5AIAgAAcAAAAHhWNBIAAAAAAAAAAIABAAAG" |
| "AAAAcAAAAAMAAACIAAAAAQAAAJQAAAAAAAAAAAAAAAIAAACgAAAAAgAAALAAAAAYAQAA8AAAABwB" |
| "AAAkAQAALwEAAEMBAABRAQAAXgEAAAEAAAACAAAABQAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAQAA" |
| "AAAAAAABAAAAAQAAAP////8AAAAABAAAAAAAAABrAQAAAAAAAAAAAAAAAAAAAQAAAAAAAAADAAAA" |
| "AAAAAHUBAAAAAAAAAQABAAAAAABhAQAAAQAAAA4AAAABAAEAAQAAAGYBAAAEAAAAcBABAAAADgAG" |
| "PGluaXQ+AAlMTXlDbGFzczsAEkxqYXZhL2xhbmcvT2JqZWN0OwAMTXlDbGFzcy5qYXZhAAtPYmpl" |
| "Y3QuamF2YQABVgADAAcOAAEABw4AAAABAAGBgATwAQAAAQAAgIAEhAIACwAAAAAAAAABAAAAAAAA" |
| "AAEAAAAGAAAAcAAAAAIAAAADAAAAiAAAAAMAAAABAAAAlAAAAAUAAAACAAAAoAAAAAYAAAACAAAA" |
| "sAAAAAEgAAACAAAA8AAAAAIgAAAGAAAAHAEAAAMgAAACAAAAYQEAAAAgAAACAAAAawEAAAAQAAAB" |
| "AAAAgAEAAA=="; |
| |
| TEST(ClassLinker, FindClass) { |
| scoped_ptr<DexFile> dex(DexFile::OpenBase64(kMyClassDex)); |
| ASSERT_TRUE(dex != NULL); |
| |
| ClassLinker linker; |
| linker.AppendToClassPath(dex.get()); |
| Class* klass = linker.FindClass("LMyClass;", NULL, dex.get()); |
| EXPECT_TRUE(klass != NULL); |
| } |
| |
| } // namespace art |