Carl Shapiro | 0e5d75d | 2011-07-06 18:28:37 -0700 | [diff] [blame^] | 1 | // Copyright 2011 Google Inc. All Rights Reserved. |
| 2 | |
| 3 | #include "src/class_linker.h" |
| 4 | #include "src/dex_file.h" |
| 5 | #include "gtest/gtest.h" |
| 6 | |
| 7 | namespace art { |
| 8 | |
| 9 | static const char kMyClassDex[] = |
| 10 | "ZGV4CjAzNQDyNgSqujckc8oAvOKGLvz3+wrLfW9ED5AIAgAAcAAAAHhWNBIAAAAAAAAAAIABAAAG" |
| 11 | "AAAAcAAAAAMAAACIAAAAAQAAAJQAAAAAAAAAAAAAAAIAAACgAAAAAgAAALAAAAAYAQAA8AAAABwB" |
| 12 | "AAAkAQAALwEAAEMBAABRAQAAXgEAAAEAAAACAAAABQAAAAUAAAACAAAAAAAAAAAAAAAAAAAAAQAA" |
| 13 | "AAAAAAABAAAAAQAAAP////8AAAAABAAAAAAAAABrAQAAAAAAAAAAAAAAAAAAAQAAAAAAAAADAAAA" |
| 14 | "AAAAAHUBAAAAAAAAAQABAAAAAABhAQAAAQAAAA4AAAABAAEAAQAAAGYBAAAEAAAAcBABAAAADgAG" |
| 15 | "PGluaXQ+AAlMTXlDbGFzczsAEkxqYXZhL2xhbmcvT2JqZWN0OwAMTXlDbGFzcy5qYXZhAAtPYmpl" |
| 16 | "Y3QuamF2YQABVgADAAcOAAEABw4AAAABAAGBgATwAQAAAQAAgIAEhAIACwAAAAAAAAABAAAAAAAA" |
| 17 | "AAEAAAAGAAAAcAAAAAIAAAADAAAAiAAAAAMAAAABAAAAlAAAAAUAAAACAAAAoAAAAAYAAAACAAAA" |
| 18 | "sAAAAAEgAAACAAAA8AAAAAIgAAAGAAAAHAEAAAMgAAACAAAAYQEAAAAgAAACAAAAawEAAAAQAAAB" |
| 19 | "AAAAgAEAAA=="; |
| 20 | |
| 21 | TEST(ClassLinker, FindClass) { |
| 22 | scoped_ptr<DexFile> dex(DexFile::OpenBase64(kMyClassDex)); |
| 23 | ASSERT_TRUE(dex != NULL); |
| 24 | |
| 25 | ClassLinker linker; |
| 26 | linker.AppendToClassPath(dex.get()); |
| 27 | Class* klass = linker.FindClass("LMyClass;", NULL, dex.get()); |
| 28 | EXPECT_TRUE(klass != NULL); |
| 29 | } |
| 30 | |
| 31 | } // namespace art |