diff --git a/core/modules/file/tests/file_module_test.module b/core/modules/file/tests/file_module_test.module
index 2fdadb8..3880138 100644
--- a/core/modules/file/tests/file_module_test.module
+++ b/core/modules/file/tests/file_module_test.module
@@ -69,3 +69,17 @@ function file_module_test_form_submit($form, &$form_state) {
   }
   drupal_set_message(t('The file id is %fid.', array('%fid' => $fid)));
 }
+
+/**
+ * Implements hook_file_download_access().
+ */
+function file_module_test_file_download_access($field, $entity_type, $entity) {
+  list(,, $bundle) = entity_extract_ids($entity_type, $entity);
+  $instance = field_info_instance($entity_type, $field['field_name'], $bundle);
+  // Allow the file to be downloaded only if the given arguments are correct: if
+  // any of them is wrong $instance is NULL. Otherwise we must not interfere
+  // with the access check.
+  if (empty($instance)) {
+    return FALSE;
+  }
+}
