Add conscrypt to art tests

Change-Id: I26694517d398b0f84f48c7496c3159b7863fa833
diff --git a/build/Android.oat.mk b/build/Android.oat.mk
index 92a86c7..2daf5d0 100644
--- a/build/Android.oat.mk
+++ b/build/Android.oat.mk
@@ -39,7 +39,7 @@
 
 ########################################################################
 # A smaller libcore only oat file
-TARGET_CORE_JARS := core core-junit bouncycastle
+TARGET_CORE_JARS := core conscrypt okhttp core-junit bouncycastle
 HOST_CORE_JARS := $(addsuffix -hostdex,$(TARGET_CORE_JARS))
 
 HOST_CORE_DEX_LOCATIONS   := $(foreach jar,$(HOST_CORE_JARS),  $(HOST_OUT_JAVA_LIBRARIES)/$(jar).jar)
diff --git a/src/common_test.h b/src/common_test.h
index 6876274..78d86d2 100644
--- a/src/common_test.h
+++ b/src/common_test.h
@@ -311,7 +311,9 @@
     ASSERT_EQ(mkdir_result, 0);
 
     java_lang_dex_file_ = DexFile::Open(GetLibCoreDexFileName(), GetLibCoreDexFileName());
+    conscrypt_file_ = DexFile::Open(GetConscryptFileName(), GetConscryptFileName());
     boot_class_path_.push_back(java_lang_dex_file_);
+    boot_class_path_.push_back(conscrypt_file_);
 
     std::string min_heap_string(StringPrintf("-Xms%zdm", Heap::kDefaultInitialSize / MB));
     std::string max_heap_string(StringPrintf("-Xmx%zdm", Heap::kDefaultMaximumSize / MB));
@@ -416,6 +418,10 @@
     return GetDexFileName("core");
   }
 
+  std::string GetConscryptFileName() {
+    return GetDexFileName("conscrypt");
+  }
+
   std::string GetDexFileName(const std::string& jar_prefix) {
     if (IsHost()) {
       const char* host_dir = getenv("ANDROID_HOST_OUT");
@@ -529,6 +535,7 @@
   std::string android_data_;
   std::string art_cache_;
   const DexFile* java_lang_dex_file_;  // owned by runtime_
+  const DexFile* conscrypt_file_;  // owned by runtime_
   std::vector<const DexFile*> boot_class_path_;
   UniquePtr<Runtime> runtime_;
   // Owned by the runtime
diff --git a/src/dex_method_iterator_test.cc b/src/dex_method_iterator_test.cc
index e4a42db..64c645e 100644
--- a/src/dex_method_iterator_test.cc
+++ b/src/dex_method_iterator_test.cc
@@ -26,6 +26,8 @@
   ScopedObjectAccess soa(Thread::Current());
   std::vector<const DexFile*> dex_files;
   dex_files.push_back(DexFile::Open(GetDexFileName("core"), GetDexFileName("core")));
+  dex_files.push_back(DexFile::Open(GetDexFileName("conscrypt"), GetDexFileName("conscrypt")));
+  dex_files.push_back(DexFile::Open(GetDexFileName("okhttp"), GetDexFileName("okhttp")));
   dex_files.push_back(DexFile::Open(GetDexFileName("core-junit"), GetDexFileName("core-junit")));
   dex_files.push_back(DexFile::Open(GetDexFileName("bouncycastle"), GetDexFileName("bouncycastle")));
   DexMethodIterator it(dex_files);
diff --git a/src/image_test.cc b/src/image_test.cc
index 192e28a..8066a90 100644
--- a/src/image_test.cc
+++ b/src/image_test.cc
@@ -46,16 +46,20 @@
       ScopedObjectAccess soa(Thread::Current());
       std::vector<const DexFile*> dex_files;
       dex_files.push_back(java_lang_dex_file_);
+      dex_files.push_back(conscrypt_file_);
       VectorOutputStream output_stream(tmp_elf.GetFilename(), oat_contents);
       bool success_oat = OatWriter::Create(output_stream, dex_files, 0, 0, "", *compiler_driver_.get());
       ASSERT_TRUE(success_oat);
 
       // Force all system classes into memory
-      for (size_t i = 0; i < java_lang_dex_file_->NumClassDefs(); ++i) {
-        const DexFile::ClassDef& class_def = java_lang_dex_file_->GetClassDef(i);
-        const char* descriptor = java_lang_dex_file_->GetClassDescriptor(class_def);
-        mirror::Class* klass = class_linker_->FindSystemClass(descriptor);
-        EXPECT_TRUE(klass != NULL) << descriptor;
+      for (size_t dex_file_index = 0; dex_file_index < dex_files.size(); ++dex_file_index) {
+        const DexFile* dex_file = dex_files[dex_file_index];
+        for (size_t class_def_index = 0; class_def_index < dex_file->NumClassDefs(); ++class_def_index) {
+          const DexFile::ClassDef& class_def = dex_file->GetClassDef(class_def_index);
+          const char* descriptor = dex_file->GetClassDescriptor(class_def);
+          mirror::Class* klass = class_linker_->FindSystemClass(descriptor);
+          EXPECT_TRUE(klass != NULL) << descriptor;
+        }
       }
       bool success_elf = compiler_driver_->WriteElf(GetTestAndroidRoot(),
                                                     !kIsTargetBuild,
diff --git a/src/oat_test.cc b/src/oat_test.cc
index 5d6edf2..a7fbaf1 100644
--- a/src/oat_test.cc
+++ b/src/oat_test.cc
@@ -106,7 +106,7 @@
   ASSERT_TRUE(oat_file.get() != NULL);
   const OatHeader& oat_header = oat_file->GetOatHeader();
   ASSERT_TRUE(oat_header.IsValid());
-  ASSERT_EQ(1U, oat_header.GetDexFileCount());
+  ASSERT_EQ(2U, oat_header.GetDexFileCount());  // core and conscrypt
   ASSERT_EQ(42U, oat_header.GetImageFileLocationOatChecksum());
   ASSERT_EQ(4096U, oat_header.GetImageFileLocationOatDataBegin());
   ASSERT_EQ("lue.art", oat_header.GetImageFileLocation());