diff --git a/core/modules/aggregator/tests/aggregator_test.module b/core/modules/aggregator/tests/aggregator_test.module
index 87081d7..2ce38ed 100644
--- a/core/modules/aggregator/tests/aggregator_test.module
+++ b/core/modules/aggregator/tests/aggregator_test.module
@@ -6,13 +6,6 @@
  * Implements hook_menu().
  */
 function aggregator_test_menu() {
-  $items['aggregator/test-feed'] = array(
-    'title' => 'Test feed static last modified date',
-    'description' => "A cached test feed with a static last modified date.",
-    'page callback' => 'aggregator_test_feed',
-    'access arguments' => array('access content'),
-    'type' => MENU_CALLBACK,
-  );
   $items['aggregator/redirect'] = array(
     'title' => 'Test feed with a redirect',
     'description' => "A feed that redirects to another one",
@@ -24,49 +17,6 @@ function aggregator_test_menu() {
 }
 
 /**
- * Page callback. Generates a test feed and simulates last-modified and etags.
- *
- * @param $use_last_modified
- *   Set TRUE to send a last modified header.
- * @param $use_etag
- *   Set TRUE to send an etag.
- */
-function aggregator_test_feed($use_last_modified = FALSE, $use_etag = FALSE) {
-  $last_modified = strtotime('Sun, 19 Nov 1978 05:00:00 GMT');
-  $etag = Crypt::hashBase64($last_modified);
-
-  $if_modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) : FALSE;
-  $if_none_match = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) : FALSE;
-
-  // Send appropriate response. We respond with a 304 not modified on either
-  // etag or on last modified.
-  if ($use_last_modified) {
-    drupal_add_http_header('Last-Modified', gmdate(DATE_RFC1123, $last_modified));
-  }
-  if ($use_etag) {
-    drupal_add_http_header('ETag', $etag);
-  }
-  // Return 304 not modified if either last modified or etag match.
-  if ($last_modified == $if_modified_since || $etag == $if_none_match) {
-    drupal_add_http_header('Status', '304 Not Modified');
-    return;
-  }
-
-  // The following headers force validation of cache:
-  drupal_add_http_header('Expires', 'Sun, 19 Nov 1978 05:00:00 GMT');
-  drupal_add_http_header('Cache-Control', 'must-revalidate');
-  drupal_add_http_header('Content-Type', 'application/rss+xml; charset=utf-8');
-
-  // Read actual feed from file.
-  $file_name = __DIR__ . '/aggregator_test_rss091.xml';
-  $handle = fopen($file_name, 'r');
-  $feed = fread($handle, filesize($file_name));
-  fclose($handle);
-
-  print $feed;
-}
-
-/**
  * Page callback that redirects to another feed.
  */
 function aggregator_test_redirect() {
diff --git a/core/modules/aggregator/tests/aggregator_test.routing.yml b/core/modules/aggregator/tests/aggregator_test.routing.yml
new file mode 100644
index 0000000..d24f754
--- /dev/null
+++ b/core/modules/aggregator/tests/aggregator_test.routing.yml
@@ -0,0 +1,8 @@
+aggregator_test_feed:
+  pattern: '/aggregator/test-feed/{use_etag}/{use_last_modified}'
+  defaults:
+    _controller: '\Drupal\aggregator_test\Controller\AggregatorTestController::testFeed'
+    use_etag: '0'
+    use_last_modified: '0'
+  requirements:
+    _permission: 'access content'
diff --git a/core/modules/aggregator/tests/lib/Drupal/aggregator_test/Controller/AggregatorTestController.php b/core/modules/aggregator/tests/lib/Drupal/aggregator_test/Controller/AggregatorTestController.php
new file mode 100644
index 0000000..931026e
--- /dev/null
+++ b/core/modules/aggregator/tests/lib/Drupal/aggregator_test/Controller/AggregatorTestController.php
@@ -0,0 +1,59 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\aggregator_test\Controller\AggregatorTestController.
+ */
+
+namespace Drupal\aggregator_test\Controller;
+
+use Drupal\Component\Utility\Crypt;
+use Drupal\Core\Controller\ControllerInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+use Symfony\Component\HttpFoundation\BinaryFileResponse;
+use Symfony\Component\HttpFoundation\Request;
+
+/**
+ * Controller routines for the aggregator test routes.
+ */
+class AggregatorTestController implements ControllerInterface {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container) {
+    return new static();
+  }
+
+  /**
+   * Returns a test feed.
+   *
+   * @param bool $use_etag
+   *   Whether to set an ETag header on the response.
+   * @param bool $use_last_modified
+   *   Whether to set a Last-Modified header on the response.
+   *
+   * @return \Symfony\Component\HttpFoundation\BinaryFileResponse
+   *   The test RSS feed.
+   */
+  public function testFeed($use_etag, $use_last_modified) {
+    $filename = drupal_get_path('module', 'aggregator_test') . '/aggregator_test_rss091.xml';
+    $headers = array(
+      'Content-Type' => 'application/rss+xml; charset=utf-8',
+    );
+    $response = new BinaryFileResponse($filename, 200, $headers, TRUE, NULL, FALSE, FALSE);
+
+    $last_modified = new \DateTime('Sun, 19 Nov 1978 05:00:00 GMT');
+
+    if ($use_last_modified) {
+      $response->setLastModified($last_modified);
+    }
+
+    if ($use_etag) {
+      $response->setETag(Crypt::hashBase64($last_modified->getTimestamp()));
+    }
+
+    return $response;
+  }
+
+}
