Add unittest for load cache manifest success path

Add a unittest that generates a valid manifest, signed with unittest
keys. Then assert that download action can load the cached manifest
correctly.

Since the unittest keys are RSA keys, we add support for RSA keys to
payload_verifier

Test: treehugger
Change-Id: Iebf4bd740ad2c18f4e71527eeee4c12e3f8e7dea
diff --git a/download_action.cc b/download_action.cc
index 076ee2c..0456298 100644
--- a/download_action.cc
+++ b/download_action.cc
@@ -105,11 +105,14 @@
     return false;
   }
 
+  if (writer_ && writer_ != delta_performer_.get()) {
+    LOG(INFO) << "Using writer for test.";
+  }
   ErrorCode error;
   const bool success =
-      delta_performer_->Write(
+      writer_->Write(
           cached_manifest_bytes.data(), cached_manifest_bytes.size(), &error) &&
-      delta_performer_->IsManifestValid();
+      writer_->IsManifestValid();
   if (success) {
     LOG(INFO) << "Successfully parsed cached manifest";
   } else {
@@ -162,9 +165,9 @@
                               manifest_metadata_size + manifest_signature_size);
     }
 
-    // If there're remaining unprocessed data blobs, fetch them. Be careful not
-    // to request data beyond the end of the payload to avoid 416 HTTP response
-    // error codes.
+    // If there're remaining unprocessed data blobs, fetch them. Be careful
+    // not to request data beyond the end of the payload to avoid 416 HTTP
+    // response error codes.
     int64_t next_data_offset = 0;
     prefs_->GetInt64(kPrefsUpdateStateNextDataOffset, &next_data_offset);
     uint64_t resume_offset =