diff --git a/core/core.services.yml b/core/core.services.yml
index 328acd8..0982f21 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -512,7 +512,7 @@ services:
     class: Drupal\Core\Utility\UnroutedUrlAssembler
     arguments: ['@request_stack', '@config.factory', '@path_processor_manager']
   link_generator:
-    class: Drupal\Core\Utility\LinkGenerator
+    class: Drupal\Core\Render\LinkGenerator
     arguments: ['@url_generator', '@module_handler']
   router:
     class: Drupal\Core\Routing\AccessAwareRouter
diff --git a/core/includes/common.inc b/core/includes/common.inc
index 11f8a9d..2ab5add 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -631,7 +631,7 @@ function drupal_http_header_attributes(array $attributes = array()) {
  * translators.
  *
  * This function does not support generating links from internal routes. For
- * that use \Drupal\Core\Utility\LinkGenerator::generate(), which is exposed via
+ * that use \Drupal\Core\Render\LinkGenerator::generate(), which is exposed via
  * the 'link_generator' service. It requires an internal route name and does not
  * support external URLs. Using Drupal 7 style system paths should be avoided if
  * possible but l() should still be used when rendering links to external URLs.
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index c89b734..9b90ad5 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -627,8 +627,8 @@ function template_preprocess_status_messages(&$variables) {
  * class. I.e. we cannot yet convert this jQuery selector to a CSS selector:
  *   jQuery('li:has("a.active")')
  *
- * @see \Drupal\Core\Utility\LinkGenerator
- * @see \Drupal\Core\Utility\LinkGenerator::generate()
+ * @see \Drupal\Core\Render\LinkGenerator
+ * @see \Drupal\Core\Render\LinkGenerator::generate()
  * @see system_page_attachments()
  */
 function template_preprocess_links(&$variables) {
diff --git a/core/lib/Drupal.php b/core/lib/Drupal.php
index 141686f..d9df4b4 100644
--- a/core/lib/Drupal.php
+++ b/core/lib/Drupal.php
@@ -489,7 +489,7 @@ public static function url($route_name, $route_parameters = array(), $options =
   /**
    * Returns the link generator service.
    *
-   * @return \Drupal\Core\Utility\LinkGeneratorInterface
+   * @return \Drupal\Core\Render\LinkGeneratorInterface
    */
   public static function linkGenerator() {
     return static::$container->get('link_generator');
@@ -502,7 +502,7 @@ public static function linkGenerator() {
    * generate() method. For detailed documentation, see
    * \Drupal\Core\Routing\LinkGeneratorInterface::generate().
    *
-   * @see \Drupal\Core\Utility\LinkGeneratorInterface::generate()
+   * @see \Drupal\Core\Render\LinkGeneratorInterface::generate()
    * @see \Drupal\Core\Url
    */
   public static function l($text, Url $url) {
diff --git a/core/lib/Drupal/Component/Utility/UrlHelper.php b/core/lib/Drupal/Component/Utility/UrlHelper.php
index 691413e..779b780 100644
--- a/core/lib/Drupal/Component/Utility/UrlHelper.php
+++ b/core/lib/Drupal/Component/Utility/UrlHelper.php
@@ -133,7 +133,7 @@ public static function filterQueryParameters(array $query, array $exclude = arra
    *   - query: An array of query parameters from $url, if they exist.
    *   - fragment: The fragment component from $url, if it exists.
    *
-   * @see \Drupal\Core\Utility\LinkGenerator
+   * @see \Drupal\Core\Render\LinkGenerator
    * @see _url()
    * @see http://tools.ietf.org/html/rfc3986
    *
diff --git a/core/lib/Drupal/Core/Render/LinkGenerator.php b/core/lib/Drupal/Core/Render/LinkGenerator.php
new file mode 100644
index 0000000..a605419
--- /dev/null
+++ b/core/lib/Drupal/Core/Render/LinkGenerator.php
@@ -0,0 +1,143 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Render\LinkGenerator.
+ */
+
+namespace Drupal\Core\Render;
+
+use Drupal\Component\Serialization\Json;
+use Drupal\Component\Utility\SafeMarkup;
+use Drupal\Component\Utility\String;
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Link;
+use Drupal\Core\Path\AliasManagerInterface;
+use Drupal\Core\Routing\UrlGeneratorInterface;
+use Drupal\Core\Template\Attribute;
+use Drupal\Core\Url;
+
+/**
+ * Provides a class which generates a link with route names and parameters.
+ */
+class LinkGenerator implements LinkGeneratorInterface {
+
+  /**
+   * The url generator.
+   *
+   * @var \Drupal\Core\Routing\UrlGeneratorInterface
+   */
+  protected $urlGenerator;
+
+  /**
+   * The module handler firing the route_link alter hook.
+   *
+   * @var \Drupal\Core\Extension\ModuleHandlerInterface
+   */
+  protected $moduleHandler;
+
+  /**
+   * Constructs a LinkGenerator instance.
+   *
+   * @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator
+   *   The url generator.
+   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
+   *   The module handler.
+   */
+  public function __construct(UrlGeneratorInterface $url_generator, ModuleHandlerInterface $module_handler) {
+    $this->urlGenerator = $url_generator;
+    $this->moduleHandler = $module_handler;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function generateFromLink(Link $link) {
+    return $this->generate($link->getText(), $link->getUrl());
+  }
+
+  /**
+   * {@inheritdoc}
+   *
+   * For anonymous users, the "active" class will be calculated on the server,
+   * because most sites serve each anonymous user the same cached page anyway.
+   * For authenticated users, the "active" class will be calculated on the
+   * client (through JavaScript), only data- attributes are added to links to
+   * prevent breaking the render cache. The JavaScript is added in
+   * system_page_attachments().
+   *
+   * @see system_page_attachments()
+   */
+  public function generate($text, Url $url) {
+    // Performance: avoid Url::toString() needing to retrieve the URL generator
+    // service from the container.
+    $url->setUrlGenerator($this->urlGenerator);
+
+    // Start building a structured representation of our link to be altered later.
+    $variables = array(
+      // @todo Inject the service when drupal_render() is converted to one.
+      'text' => is_array($text) ? drupal_render($text) : $text,
+      'url' => $url,
+      'options' => $url->getOptions(),
+    );
+
+    // Merge in default options.
+    $variables['options'] += array(
+      'attributes' => array(),
+      'query' => array(),
+      'html' => FALSE,
+      'language' => NULL,
+      'set_active_class' => FALSE,
+      'absolute' => FALSE,
+    );
+
+    // Add a hreflang attribute if we know the language of this link's url and
+    // hreflang has not already been set.
+    if (!empty($variables['options']['language']) && !isset($variables['options']['attributes']['hreflang'])) {
+      $variables['options']['attributes']['hreflang'] = $variables['options']['language']->getId();
+    }
+
+    // Set the "active" class if the 'set_active_class' option is not empty.
+    if (!empty($variables['options']['set_active_class']) && !$url->isExternal()) {
+      // Add a "data-drupal-link-query" attribute to let the
+      // drupal.active-link library know the query in a standardized manner.
+      if (!empty($variables['options']['query'])) {
+        $query = $variables['options']['query'];
+        ksort($query);
+        $variables['options']['attributes']['data-drupal-link-query'] = Json::encode($query);
+      }
+
+      // Add a "data-drupal-link-system-path" attribute to let the
+      // drupal.active-link library know the path in a standardized manner.
+      if ($url->isRouted() && !isset($variables['options']['attributes']['data-drupal-link-system-path'])) {
+        // @todo System path is deprecated - use the route name and parameters.
+        $system_path = $url->getInternalPath();
+        // Special case for the front page.
+        $variables['options']['attributes']['data-drupal-link-system-path'] = $system_path == '' ? '<front>' : $system_path;
+      }
+    }
+
+    // Remove all HTML and PHP tags from a tooltip, calling expensive strip_tags()
+    // only when a quick strpos() gives suspicion tags are present.
+    if (isset($variables['options']['attributes']['title']) && strpos($variables['options']['attributes']['title'], '<') !== FALSE) {
+      $variables['options']['attributes']['title'] = strip_tags($variables['options']['attributes']['title']);
+    }
+
+    // Allow other modules to modify the structure of the link.
+    $this->moduleHandler->alter('link', $variables);
+
+    // Move attributes out of options. generateFromRoute(() doesn't need them.
+    $attributes = new Attribute($variables['options']['attributes']);
+    unset($variables['options']['attributes']);
+    $url->setOptions($variables['options']);
+
+    // The result of the url generator is a plain-text URL. Because we are using
+    // it here in an HTML argument context, we need to encode it properly.
+    $url = String::checkPlain($url->toString());
+
+    // Sanitize the link text if necessary.
+    $text = $variables['options']['html'] ? $variables['text'] : String::checkPlain($variables['text']);
+    return SafeMarkup::set('<a href="' . $url . '"' . $attributes . '>' . $text . '</a>');
+  }
+
+}
diff --git a/core/lib/Drupal/Core/Render/LinkGeneratorInterface.php b/core/lib/Drupal/Core/Render/LinkGeneratorInterface.php
new file mode 100644
index 0000000..6479a19
--- /dev/null
+++ b/core/lib/Drupal/Core/Render/LinkGeneratorInterface.php
@@ -0,0 +1,79 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Render\LinkGeneratorInterface.
+ */
+
+namespace Drupal\Core\Render;
+
+use Drupal\Core\Link;
+use Drupal\Core\Url;
+
+/**
+ * Defines an interface for generating links from route names and parameters.
+ */
+interface LinkGeneratorInterface {
+
+  /**
+   * Renders a link to a URL.
+   *
+   * However, for links enclosed in translatable text you should use t() and
+   * embed the HTML anchor tag directly in the translated string. For example:
+   * @code
+   * t('Visit the <a href="@url">content types</a> page', array('@url' => \Drupal::url('node.overview_types')));
+   * @endcode
+   * This keeps the context of the link title ('settings' in the example) for
+   * translators.
+   *
+   * @param string|array $text
+   *   The link text for the anchor tag as a translated string or render array.
+   * @param \Drupal\Core\Url $url
+   *   The URL object used for the link. Amongst its options, the following may
+   *   be set to affect the generated link:
+   *   - attributes: An associative array of HTML attributes to apply to the
+   *     anchor tag. If element 'class' is included, it must be an array; 'title'
+   *     must be a string; other elements are more flexible, as they just need
+   *     to work as an argument for the constructor of the class
+   *     Drupal\Core\Template\Attribute($options['attributes']).
+   *   - html: Whether $text is HTML or just plain-text. For
+   *     example, to make an image tag into a link, this must be set to TRUE, or
+   *     you will see the escaped HTML image tag. $text is not sanitized if
+   *     'html' is TRUE. The calling function must ensure that $text is already
+   *     safe. Defaults to FALSE.
+   *   - language: An optional language object. If the path being linked to is
+   *     internal to the site, $options['language'] is used to determine whether
+   *     the link is "active", or pointing to the current page (the language as
+   *     well as the path must match).
+   *   - 'set_active_class': Whether this method should compare the $route_name,
+   *     $parameters, language and query options to the current URL to determine
+   *     whether the link is "active". Defaults to FALSE. If TRUE, an "active"
+   *     class will be applied to the link. It is important to use this
+   *     sparingly since it is usually unnecessary and requires extra
+   *     processing.
+   *
+   * @return string
+   *   An HTML string containing a link to the given route and parameters.
+   *
+   * @throws \Symfony\Component\Routing\Exception\RouteNotFoundException
+   *   Thrown when the named route doesn't exist.
+   * @throws \Symfony\Component\Routing\Exception\MissingMandatoryParametersException
+   *   Thrown when some parameters are missing that are mandatory for the route.
+   * @throws \Symfony\Component\Routing\Exception\InvalidParameterException
+   *   Thrown when a parameter value for a placeholder is not correct because it
+   *   does not match the requirement.
+   */
+  public function generate($text, Url $url);
+
+  /**
+   * Renders a link from a link object.
+   *
+   * @param \Drupal\Core\Link $link
+   *   A link object to convert to a string.
+   *
+   * @return string
+   *   An HTML string containing a link to the given link.
+   */
+  public function generateFromLink(Link $link);
+
+}
diff --git a/core/lib/Drupal/Core/Routing/LinkGeneratorTrait.php b/core/lib/Drupal/Core/Routing/LinkGeneratorTrait.php
index ff84971..012c5a8 100644
--- a/core/lib/Drupal/Core/Routing/LinkGeneratorTrait.php
+++ b/core/lib/Drupal/Core/Routing/LinkGeneratorTrait.php
@@ -8,7 +8,7 @@
 
 
 use Drupal\Core\Url;
-use Drupal\Core\Utility\LinkGeneratorInterface;
+use Drupal\Core\Render\LinkGeneratorInterface;
 use Drupal\Core\Routing\UrlGeneratorInterface;
 
 /**
@@ -24,14 +24,14 @@
   /**
    * The link generator.
    *
-   * @var \Drupal\Core\Utility\LinkGeneratorInterface
+   * @var \Drupal\Core\Render\LinkGeneratorInterface
    */
   protected $linkGenerator;
 
   /**
    * Renders a link to a route given a route name and its parameters.
    *
-   * @see \Drupal\Core\Utility\LinkGeneratorInterface::generate() for details
+   * @see \Drupal\Core\Render\LinkGeneratorInterface::generate() for details
    *   on the arguments, usage, and possible exceptions.
    *
    * @return string
@@ -44,7 +44,7 @@ protected function l($text, Url $url) {
   /**
    * Returns the link generator.
    *
-   * @return \Drupal\Core\Utility\LinkGeneratorInterface
+   * @return \Drupal\Core\Render\LinkGeneratorInterface
    *   The link generator
    */
   protected function getLinkGenerator() {
@@ -57,7 +57,7 @@ protected function getLinkGenerator() {
   /**
    * Sets the link generator service.
    *
-   * @param \Drupal\Core\Utility\LinkGeneratorInterface $generator
+   * @param \Drupal\Core\Render\LinkGeneratorInterface $generator
    *   The link generator service.
    *
    * @return $this
diff --git a/core/lib/Drupal/Core/Template/TwigExtension.php b/core/lib/Drupal/Core/Template/TwigExtension.php
index 511cefb..333623b 100644
--- a/core/lib/Drupal/Core/Template/TwigExtension.php
+++ b/core/lib/Drupal/Core/Template/TwigExtension.php
@@ -14,7 +14,7 @@
 
 use Drupal\Core\Routing\UrlGeneratorInterface;
 use Drupal\Core\Url;
-use Drupal\Core\Utility\LinkGeneratorInterface;
+use Drupal\Core\Render\LinkGeneratorInterface;
 
 /**
  * A class providing Drupal Twig extensions.
@@ -35,7 +35,7 @@ class TwigExtension extends \Twig_Extension {
   /**
    * The link generator.
    *
-   * @var \Drupal\Core\Utility\LinkGeneratorInterface
+   * @var \Drupal\Core\Render\LinkGeneratorInterface
    */
   protected $linkGenerator;
 
@@ -53,7 +53,7 @@ public function setGenerators(UrlGeneratorInterface $url_generator) {
   /**
    * Sets the link generator.
    *
-   * @param \Drupal\Core\Utility\LinkGeneratorInterface $link_generator
+   * @param \Drupal\Core\Render\LinkGeneratorInterface $link_generator
    *   The link generator.
    *
    * @return $this
diff --git a/core/lib/Drupal/Core/Utility/LinkGenerator.php b/core/lib/Drupal/Core/Utility/LinkGenerator.php
deleted file mode 100644
index a6e8326..0000000
--- a/core/lib/Drupal/Core/Utility/LinkGenerator.php
+++ /dev/null
@@ -1,143 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Utility\LinkGenerator.
- */
-
-namespace Drupal\Core\Utility;
-
-use Drupal\Component\Serialization\Json;
-use Drupal\Component\Utility\SafeMarkup;
-use Drupal\Component\Utility\String;
-use Drupal\Core\Extension\ModuleHandlerInterface;
-use Drupal\Core\Link;
-use Drupal\Core\Path\AliasManagerInterface;
-use Drupal\Core\Routing\UrlGeneratorInterface;
-use Drupal\Core\Template\Attribute;
-use Drupal\Core\Url;
-
-/**
- * Provides a class which generates a link with route names and parameters.
- */
-class LinkGenerator implements LinkGeneratorInterface {
-
-  /**
-   * The url generator.
-   *
-   * @var \Drupal\Core\Routing\UrlGeneratorInterface
-   */
-  protected $urlGenerator;
-
-  /**
-   * The module handler firing the route_link alter hook.
-   *
-   * @var \Drupal\Core\Extension\ModuleHandlerInterface
-   */
-  protected $moduleHandler;
-
-  /**
-   * Constructs a LinkGenerator instance.
-   *
-   * @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator
-   *   The url generator.
-   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
-   *   The module handler.
-   */
-  public function __construct(UrlGeneratorInterface $url_generator, ModuleHandlerInterface $module_handler) {
-    $this->urlGenerator = $url_generator;
-    $this->moduleHandler = $module_handler;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function generateFromLink(Link $link) {
-    return $this->generate($link->getText(), $link->getUrl());
-  }
-
-  /**
-   * {@inheritdoc}
-   *
-   * For anonymous users, the "active" class will be calculated on the server,
-   * because most sites serve each anonymous user the same cached page anyway.
-   * For authenticated users, the "active" class will be calculated on the
-   * client (through JavaScript), only data- attributes are added to links to
-   * prevent breaking the render cache. The JavaScript is added in
-   * system_page_attachments().
-   *
-   * @see system_page_attachments()
-   */
-  public function generate($text, Url $url) {
-    // Performance: avoid Url::toString() needing to retrieve the URL generator
-    // service from the container.
-    $url->setUrlGenerator($this->urlGenerator);
-
-    // Start building a structured representation of our link to be altered later.
-    $variables = array(
-      // @todo Inject the service when drupal_render() is converted to one.
-      'text' => is_array($text) ? drupal_render($text) : $text,
-      'url' => $url,
-      'options' => $url->getOptions(),
-    );
-
-    // Merge in default options.
-    $variables['options'] += array(
-      'attributes' => array(),
-      'query' => array(),
-      'html' => FALSE,
-      'language' => NULL,
-      'set_active_class' => FALSE,
-      'absolute' => FALSE,
-    );
-
-    // Add a hreflang attribute if we know the language of this link's url and
-    // hreflang has not already been set.
-    if (!empty($variables['options']['language']) && !isset($variables['options']['attributes']['hreflang'])) {
-      $variables['options']['attributes']['hreflang'] = $variables['options']['language']->getId();
-    }
-
-    // Set the "active" class if the 'set_active_class' option is not empty.
-    if (!empty($variables['options']['set_active_class']) && !$url->isExternal()) {
-      // Add a "data-drupal-link-query" attribute to let the
-      // drupal.active-link library know the query in a standardized manner.
-      if (!empty($variables['options']['query'])) {
-        $query = $variables['options']['query'];
-        ksort($query);
-        $variables['options']['attributes']['data-drupal-link-query'] = Json::encode($query);
-      }
-
-      // Add a "data-drupal-link-system-path" attribute to let the
-      // drupal.active-link library know the path in a standardized manner.
-      if ($url->isRouted() && !isset($variables['options']['attributes']['data-drupal-link-system-path'])) {
-        // @todo System path is deprecated - use the route name and parameters.
-        $system_path = $url->getInternalPath();
-        // Special case for the front page.
-        $variables['options']['attributes']['data-drupal-link-system-path'] = $system_path == '' ? '<front>' : $system_path;
-      }
-    }
-
-    // Remove all HTML and PHP tags from a tooltip, calling expensive strip_tags()
-    // only when a quick strpos() gives suspicion tags are present.
-    if (isset($variables['options']['attributes']['title']) && strpos($variables['options']['attributes']['title'], '<') !== FALSE) {
-      $variables['options']['attributes']['title'] = strip_tags($variables['options']['attributes']['title']);
-    }
-
-    // Allow other modules to modify the structure of the link.
-    $this->moduleHandler->alter('link', $variables);
-
-    // Move attributes out of options. generateFromRoute(() doesn't need them.
-    $attributes = new Attribute($variables['options']['attributes']);
-    unset($variables['options']['attributes']);
-    $url->setOptions($variables['options']);
-
-    // The result of the url generator is a plain-text URL. Because we are using
-    // it here in an HTML argument context, we need to encode it properly.
-    $url = String::checkPlain($url->toString());
-
-    // Sanitize the link text if necessary.
-    $text = $variables['options']['html'] ? $variables['text'] : String::checkPlain($variables['text']);
-    return SafeMarkup::set('<a href="' . $url . '"' . $attributes . '>' . $text . '</a>');
-  }
-
-}
diff --git a/core/lib/Drupal/Core/Utility/LinkGeneratorInterface.php b/core/lib/Drupal/Core/Utility/LinkGeneratorInterface.php
deleted file mode 100644
index ba47197..0000000
--- a/core/lib/Drupal/Core/Utility/LinkGeneratorInterface.php
+++ /dev/null
@@ -1,79 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Utility\LinkGeneratorInterface.
- */
-
-namespace Drupal\Core\Utility;
-
-use Drupal\Core\Link;
-use Drupal\Core\Url;
-
-/**
- * Defines an interface for generating links from route names and parameters.
- */
-interface LinkGeneratorInterface {
-
-  /**
-   * Renders a link to a URL.
-   *
-   * However, for links enclosed in translatable text you should use t() and
-   * embed the HTML anchor tag directly in the translated string. For example:
-   * @code
-   * t('Visit the <a href="@url">content types</a> page', array('@url' => \Drupal::url('node.overview_types')));
-   * @endcode
-   * This keeps the context of the link title ('settings' in the example) for
-   * translators.
-   *
-   * @param string|array $text
-   *   The link text for the anchor tag as a translated string or render array.
-   * @param \Drupal\Core\Url $url
-   *   The URL object used for the link. Amongst its options, the following may
-   *   be set to affect the generated link:
-   *   - attributes: An associative array of HTML attributes to apply to the
-   *     anchor tag. If element 'class' is included, it must be an array; 'title'
-   *     must be a string; other elements are more flexible, as they just need
-   *     to work as an argument for the constructor of the class
-   *     Drupal\Core\Template\Attribute($options['attributes']).
-   *   - html: Whether $text is HTML or just plain-text. For
-   *     example, to make an image tag into a link, this must be set to TRUE, or
-   *     you will see the escaped HTML image tag. $text is not sanitized if
-   *     'html' is TRUE. The calling function must ensure that $text is already
-   *     safe. Defaults to FALSE.
-   *   - language: An optional language object. If the path being linked to is
-   *     internal to the site, $options['language'] is used to determine whether
-   *     the link is "active", or pointing to the current page (the language as
-   *     well as the path must match).
-   *   - 'set_active_class': Whether this method should compare the $route_name,
-   *     $parameters, language and query options to the current URL to determine
-   *     whether the link is "active". Defaults to FALSE. If TRUE, an "active"
-   *     class will be applied to the link. It is important to use this
-   *     sparingly since it is usually unnecessary and requires extra
-   *     processing.
-   *
-   * @return string
-   *   An HTML string containing a link to the given route and parameters.
-   *
-   * @throws \Symfony\Component\Routing\Exception\RouteNotFoundException
-   *   Thrown when the named route doesn't exist.
-   * @throws \Symfony\Component\Routing\Exception\MissingMandatoryParametersException
-   *   Thrown when some parameters are missing that are mandatory for the route.
-   * @throws \Symfony\Component\Routing\Exception\InvalidParameterException
-   *   Thrown when a parameter value for a placeholder is not correct because it
-   *   does not match the requirement.
-   */
-  public function generate($text, Url $url);
-
-  /**
-   * Renders a link from a link object.
-   *
-   * @param \Drupal\Core\Link $link
-   *   A link object to convert to a string.
-   *
-   * @return string
-   *   An HTML string containing a link to the given link.
-   */
-  public function generateFromLink(Link $link);
-
-}
diff --git a/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php b/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php
index e9ab03e..92596d7 100644
--- a/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php
+++ b/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php
@@ -13,7 +13,7 @@
 use Drupal\Core\Routing\UrlGeneratorInterface;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\Url;
-use Drupal\Core\Utility\LinkGeneratorInterface;
+use Drupal\Core\Render\LinkGeneratorInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Drupal\Core\Form\FormStateInterface;
 
@@ -40,7 +40,7 @@ class ImageFormatter extends ImageFormatterBase implements ContainerFactoryPlugi
   /**
    * The link generator.
    *
-   * @var \Drupal\Core\Utility\LinkGeneratorInterface
+   * @var \Drupal\Core\Render\LinkGeneratorInterface
    */
   protected $linkGenerator;
 
@@ -70,7 +70,7 @@ class ImageFormatter extends ImageFormatterBase implements ContainerFactoryPlugi
    *   Any third party settings settings.
    * @param \Drupal\Core\Session\AccountInterface $current_user
    *   The current user.
-   * @param \Drupal\Core\Utility\LinkGeneratorInterface $link_generator
+   * @param \Drupal\Core\Render\LinkGeneratorInterface $link_generator
    *   The link generator service.
    * @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator
    *   The url generator service.
diff --git a/core/modules/menu_ui/src/MenuForm.php b/core/modules/menu_ui/src/MenuForm.php
index 2415032..b4f2edd 100644
--- a/core/modules/menu_ui/src/MenuForm.php
+++ b/core/modules/menu_ui/src/MenuForm.php
@@ -19,7 +19,7 @@
 use Drupal\Core\Render\Element;
 use Drupal\Core\Routing\UrlGeneratorTrait;
 use Drupal\Core\Url;
-use Drupal\Core\Utility\LinkGeneratorInterface;
+use Drupal\Core\Render\LinkGeneratorInterface;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
 /**
@@ -51,7 +51,7 @@ class MenuForm extends EntityForm {
   /**
    * The link generator.
    *
-   * @var \Drupal\Core\Utility\LinkGeneratorInterface
+   * @var \Drupal\Core\Render\LinkGeneratorInterface
    */
   protected $linkGenerator;
 
@@ -71,7 +71,7 @@ class MenuForm extends EntityForm {
    *   The menu link manager.
    * @param \Drupal\Core\Menu\MenuLinkTreeInterface $menu_tree
    *   The menu tree service.
-   * @param \Drupal\Core\Utility\LinkGeneratorInterface $link_generator
+   * @param \Drupal\Core\Render\LinkGeneratorInterface $link_generator
    *   The link generator.
    */
   public function __construct(QueryFactory $entity_query_factory, MenuLinkManagerInterface $menu_link_manager, MenuLinkTreeInterface $menu_tree, LinkGeneratorInterface $link_generator) {
diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php
index aeb0cb7..323773e 100644
--- a/core/modules/system/system.api.php
+++ b/core/modules/system/system.api.php
@@ -966,7 +966,7 @@ function hook_countries_alter(&$countries) {
  *
  * @param array $variables
  *   An associative array of variables defining a link. The link may be either a
- *   "route link" using \Drupal\Core\Utility\LinkGenerator::link(), which is
+ *   "route link" using \Drupal\Core\Render\LinkGenerator::link(), which is
  *   exposed as the 'link_generator' service or a link generated by _l(). If the
  *   link is a "route link", 'route_name' will be set, otherwise 'path' will be
  *   set. The following keys can be altered:
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 8f2a8ab..b0a8667 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -597,7 +597,7 @@ function system_page_attachments(array &$page) {
   // - loading the active-link library if the current user is authenticated;
   // - applying a post-render cache callback if the current user is anonymous.
   // @see l()
-  // @see \Drupal\Core\Utility\LinkGenerator::generate()
+  // @see \Drupal\Core\Render\LinkGenerator::generate()
   // @see template_preprocess_links()
   // @see \Drupal\system\Controller\SystemController::setLinkActiveClass
   if (\Drupal::currentUser()->isAuthenticated()) {
diff --git a/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php b/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php
index 8ceea8a..cf511f2 100644
--- a/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php
+++ b/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php
@@ -12,7 +12,7 @@
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\StringTranslation\TranslationInterface;
 use Drupal\Core\Url;
-use Drupal\Core\Utility\LinkGeneratorInterface;
+use Drupal\Core\Render\LinkGeneratorInterface;
 use Drupal\system\PathBasedBreadcrumbBuilder;
 use Drupal\Tests\UnitTestCase;
 use Symfony\Cmf\Component\Routing\RouteObjectInterface;
diff --git a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
index 4459ac2..d664985 100644
--- a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
+++ b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
@@ -90,7 +90,7 @@
   /**
    * The link generator.
    *
-   * @var \Drupal\Core\Utility\LinkGeneratorInterface
+   * @var \Drupal\Core\Render\LinkGeneratorInterface
    */
   protected $linkGenerator;
 
@@ -1744,7 +1744,7 @@ public static function trimText($alter, $value) {
   /**
    * Gets the link generator.
    *
-   * @return \Drupal\Core\Utility\LinkGeneratorInterface
+   * @return \Drupal\Core\Render\LinkGeneratorInterface
    */
   protected function linkGenerator() {
     if (!isset($this->linkGenerator)) {
diff --git a/core/tests/Drupal/Tests/Core/DrupalTest.php b/core/tests/Drupal/Tests/Core/DrupalTest.php
index 8a36cfd..04c6e39 100644
--- a/core/tests/Drupal/Tests/Core/DrupalTest.php
+++ b/core/tests/Drupal/Tests/Core/DrupalTest.php
@@ -324,12 +324,12 @@ public function testLinkGenerator() {
    * Tests the l() method.
    *
    * @covers ::l
-   * @see \Drupal\Core\Utility\LinkGeneratorInterface::generate()
+   * @see \Drupal\Core\Render\LinkGeneratorInterface::generate()
    */
   public function testL() {
     $route_parameters = array('test_parameter' => 'test');
     $options = array('test_option' => 'test');
-    $generator = $this->getMock('Drupal\Core\Utility\LinkGeneratorInterface');
+    $generator = $this->getMock('Drupal\Core\Render\LinkGeneratorInterface');
     $url = new Url('test_route', $route_parameters, $options);
     $generator->expects($this->once())
       ->method('generate')
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php
index 361a7ea..d18565e 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php
@@ -27,7 +27,7 @@ class EntityLinkTest extends UnitTestCase {
   /**
    * The tested link generator.
    *
-   * @var \Drupal\Core\Utility\LinkGeneratorInterface|\PHPUnit_Framework_MockObject_MockObject
+   * @var \Drupal\Core\Render\LinkGeneratorInterface|\PHPUnit_Framework_MockObject_MockObject
    */
   protected $linkGenerator;
 
@@ -38,7 +38,7 @@ protected function setUp() {
     parent::setUp();
 
     $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
-    $this->linkGenerator = $this->getMock('Drupal\Core\Utility\LinkGeneratorInterface');
+    $this->linkGenerator = $this->getMock('Drupal\Core\Render\LinkGeneratorInterface');
 
     $container = new ContainerBuilder();
     $container->set('entity.manager', $this->entityManager);
diff --git a/core/tests/Drupal/Tests/Core/Render/LinkGeneratorTest.php b/core/tests/Drupal/Tests/Core/Render/LinkGeneratorTest.php
new file mode 100644
index 0000000..6779dfb
--- /dev/null
+++ b/core/tests/Drupal/Tests/Core/Render/LinkGeneratorTest.php
@@ -0,0 +1,463 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Tests\Core\Render\LinkGeneratorTest.
+ */
+
+namespace Drupal\Tests\Core\Render {
+
+use Drupal\Core\Language\Language;
+use Drupal\Core\Url;
+use Drupal\Core\Render\LinkGenerator;
+use Drupal\Tests\UnitTestCase;
+
+/**
+ * @coversDefaultClass \Drupal\Core\Render\LinkGenerator
+ * @group Utility
+ */
+class LinkGeneratorTest extends UnitTestCase {
+
+  /**
+   * The tested link generator.
+   *
+   * @var \Drupal\Core\Render\LinkGenerator
+   */
+  protected $linkGenerator;
+
+  /**
+   * The mocked url generator.
+   *
+   * @var \PHPUnit_Framework_MockObject_MockObject
+   */
+  protected $urlGenerator;
+
+  /**
+   * The mocked module handler.
+   *
+   * @var \PHPUnit_Framework_MockObject_MockObject
+   */
+  protected $moduleHandler;
+
+  /**
+   * The mocked URL Assembler service.
+   *
+   * @var \PHPUnit_Framework_MockObject_MockObject|\Drupal\Core\Utility\UnroutedUrlAssemblerInterface
+   */
+  protected $urlAssembler;
+
+  /**
+   * Contains the LinkGenerator default options.
+   */
+  protected $defaultOptions = array(
+    'query' => array(),
+    'html' => FALSE,
+    'language' => NULL,
+    'set_active_class' => FALSE,
+    'absolute' => FALSE,
+  );
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+
+    $this->urlGenerator = $this->getMock('\Drupal\Core\Routing\UrlGenerator', array(), array(), '', FALSE);
+    $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
+
+    $this->linkGenerator = new LinkGenerator($this->urlGenerator, $this->moduleHandler);
+    $this->urlAssembler = $this->getMock('\Drupal\Core\Utility\UnroutedUrlAssemblerInterface');
+  }
+
+  /**
+   * Provides test data for testing the link method.
+   *
+   * @see \Drupal\Tests\Core\Render\LinkGeneratorTest::testGenerateHrefs()
+   *
+   * @return array
+   *   Returns some test data.
+   */
+  public function providerTestGenerateHrefs() {
+    return array(
+      // Test that the url returned by the URL generator is used.
+      array('test_route_1', array(), FALSE, '/test-route-1'),
+        // Test that $parameters is passed to the URL generator.
+      array('test_route_2', array('value' => 'example'), FALSE, '/test-route-2/example'),
+        // Test that the 'absolute' option is passed to the URL generator.
+      array('test_route_3', array(), TRUE, 'http://example.com/test-route-3'),
+    );
+  }
+
+  /**
+   * Tests the link method with certain hrefs.
+   *
+   * @see \Drupal\Core\Render\LinkGenerator::generate()
+   * @see \Drupal\Tests\Core\Render\LinkGeneratorTest::providerTestGenerate()
+   *
+   * @dataProvider providerTestGenerateHrefs
+   */
+  public function testGenerateHrefs($route_name, array $parameters, $absolute, $expected_url) {
+    $this->urlGenerator->expects($this->once())
+      ->method('generateFromRoute')
+      ->with($route_name, $parameters, array('absolute' => $absolute) + $this->defaultOptions)
+      ->will($this->returnValue($expected_url));
+
+    $this->moduleHandler->expects($this->once())
+      ->method('alter');
+
+    $url = new Url($route_name, $parameters, array('absolute' => $absolute));
+    $url->setUrlGenerator($this->urlGenerator);
+    $result = $this->linkGenerator->generate('Test', $url);
+    $this->assertTag(array(
+      'tag' => 'a',
+      'attributes' => array('href' => $expected_url),
+      ), $result);
+  }
+
+  /**
+   * Tests the generate() method with a route.
+   *
+   * @covers ::generate
+   */
+  public function testGenerate() {
+    $this->urlGenerator->expects($this->once())
+      ->method('generateFromRoute')
+      ->with('test_route_1', array(), array('fragment' => 'the-fragment') + $this->defaultOptions)
+      ->will($this->returnValue('/test-route-1#the-fragment'));
+
+    $this->moduleHandler->expects($this->once())
+      ->method('alter')
+      ->with('link', $this->isType('array'));
+
+    $url = new Url('test_route_1', array(), array('fragment' => 'the-fragment'));
+    $url->setUrlGenerator($this->urlGenerator);
+
+    $result = $this->linkGenerator->generate('Test', $url);
+    $this->assertTag(array(
+      'tag' => 'a',
+      'attributes' => array(
+        'href' => '/test-route-1#the-fragment',
+      ),
+      'content' => 'Test',
+    ), $result);
+  }
+
+  /**
+   * Tests the generate() method with an external URL.
+   *
+   * The set_active_class option is set to TRUE to ensure this does not cause
+   * an error together with an external URL.
+   *
+   * @covers ::generate
+   */
+  public function testGenerateExternal() {
+    $this->urlAssembler->expects($this->once())
+      ->method('assemble')
+      ->with('http://drupal.org', array('set_active_class' => TRUE, 'external' => TRUE) + $this->defaultOptions)
+      ->will($this->returnArgument(0));
+
+    $this->moduleHandler->expects($this->once())
+      ->method('alter')
+      ->with('link', $this->isType('array'));
+
+    $this->urlAssembler->expects($this->once())
+      ->method('assemble')
+      ->with('http://drupal.org', array('set_active_class' => TRUE, 'external' => TRUE) + $this->defaultOptions)
+      ->willReturnArgument(0);
+
+    $url = Url::fromUri('http://drupal.org');
+    $url->setUrlGenerator($this->urlGenerator);
+    $url->setUnroutedUrlAssembler($this->urlAssembler);
+    $url->setOption('set_active_class', TRUE);
+
+    $result = $this->linkGenerator->generate('Drupal', $url);
+    $this->assertTag(array(
+      'tag' => 'a',
+      'attributes' => array(
+        'href' => 'http://drupal.org',
+      ),
+      'content' => 'Drupal',
+    ), $result);
+  }
+
+  /**
+   * Tests the link method with additional attributes.
+   *
+   * @see \Drupal\Core\Render\LinkGenerator::generate()
+   */
+  public function testGenerateAttributes() {
+    $this->urlGenerator->expects($this->once())
+      ->method('generateFromRoute')
+      ->with('test_route_1', array(), $this->defaultOptions)
+      ->will($this->returnValue(
+        '/test-route-1'
+      ));
+
+    // Test that HTML attributes are added to the anchor.
+    $url = new Url('test_route_1', array(), array(
+      'attributes' => array('title' => 'Tooltip'),
+    ));
+    $url->setUrlGenerator($this->urlGenerator);
+    $result = $this->linkGenerator->generate('Test', $url);
+    $this->assertTag(array(
+      'tag' => 'a',
+      'attributes' => array(
+        'href' => '/test-route-1',
+        'title' => 'Tooltip',
+      ),
+    ), $result);
+  }
+
+  /**
+   * Tests the link method with passed query options.
+   *
+   * @see \Drupal\Core\Render\LinkGenerator::generate()
+   */
+  public function testGenerateQuery() {
+    $this->urlGenerator->expects($this->once())
+      ->method('generateFromRoute')
+      ->with('test_route_1', array(), array('query' => array('test' => 'value')) + $this->defaultOptions)
+      ->will($this->returnValue(
+        '/test-route-1?test=value'
+      ));
+
+    $url = new Url('test_route_1', array(), array(
+      'query' => array('test' => 'value'),
+    ));
+    $url->setUrlGenerator($this->urlGenerator);
+    $result = $this->linkGenerator->generate('Test', $url);
+    $this->assertTag(array(
+      'tag' => 'a',
+      'attributes' => array(
+        'href' => '/test-route-1?test=value',
+      ),
+    ), $result);
+  }
+
+  /**
+   * Tests the link method with passed query options via parameters.
+   *
+   * @see \Drupal\Core\Render\LinkGenerator::generate()
+   */
+  public function testGenerateParametersAsQuery() {
+    $this->urlGenerator->expects($this->once())
+      ->method('generateFromRoute')
+      ->with('test_route_1', array('test' => 'value'), $this->defaultOptions)
+      ->will($this->returnValue(
+        '/test-route-1?test=value'
+      ));
+
+    $url = new Url('test_route_1', array('test' => 'value'), array());
+    $url->setUrlGenerator($this->urlGenerator);
+    $result = $this->linkGenerator->generate('Test', $url);
+    $this->assertTag(array(
+      'tag' => 'a',
+      'attributes' => array(
+        'href' => '/test-route-1?test=value',
+      ),
+    ), $result);
+  }
+
+  /**
+   * Tests the link method with arbitrary passed options.
+   *
+   * @see \Drupal\Core\Render\LinkGenerator::generate()
+   */
+  public function testGenerateOptions() {
+    $this->urlGenerator->expects($this->once())
+      ->method('generateFromRoute')
+      ->with('test_route_1', array(), array('key' => 'value') + $this->defaultOptions)
+      ->will($this->returnValue(
+        '/test-route-1?test=value'
+      ));
+
+    $url = new Url('test_route_1', array(), array(
+      'key' => 'value',
+    ));
+    $url->setUrlGenerator($this->urlGenerator);
+    $result = $this->linkGenerator->generate('Test', $url);
+    $this->assertTag(array(
+      'tag' => 'a',
+      'attributes' => array(
+        'href' => '/test-route-1?test=value',
+      ),
+    ), $result);
+  }
+
+  /**
+   * Tests the link method with a script tab.
+   *
+   * @see \Drupal\Core\Render\LinkGenerator::generate()
+   */
+  public function testGenerateXss() {
+    $this->urlGenerator->expects($this->once())
+      ->method('generateFromRoute')
+      ->with('test_route_4', array(), $this->defaultOptions)
+      ->will($this->returnValue(
+        '/test-route-4'
+      ));
+
+    // Test that HTML link text is escaped by default.
+    $url = new Url('test_route_4');
+    $url->setUrlGenerator($this->urlGenerator);
+    $result = $this->linkGenerator->generate("<script>alert('XSS!')</script>", $url);
+    $this->assertNotTag(array(
+      'tag' => 'a',
+      'attributes' => array('href' => '/test-route-4'),
+      'child' => array(
+        'tag' => 'script',
+      ),
+    ), $result);
+  }
+
+  /**
+   * Tests the link method with html.
+   *
+   * @see \Drupal\Core\Render\LinkGenerator::generate()
+   */
+  public function testGenerateWithHtml() {
+    $this->urlGenerator->expects($this->at(0))
+      ->method('generateFromRoute')
+      ->with('test_route_5', array(), $this->defaultOptions)
+      ->will($this->returnValue(
+        '/test-route-5'
+      ));
+    $this->urlGenerator->expects($this->at(1))
+      ->method('generateFromRoute')
+      ->with('test_route_5', array(), array('html' => TRUE) + $this->defaultOptions)
+      ->will($this->returnValue(
+        '/test-route-5'
+      ));
+
+    // Test that HTML tags are stripped from the 'title' attribute.
+    $url = new Url('test_route_5', array(), array(
+      'attributes' => array('title' => '<em>HTML Tooltip</em>'),
+    ));
+    $url->setUrlGenerator($this->urlGenerator);
+    $result = $this->linkGenerator->generate('Test', $url);
+    $this->assertTag(array(
+      'tag' => 'a',
+      'attributes' => array(
+        'href' => '/test-route-5',
+        'title' => 'HTML Tooltip',
+      ),
+    ), $result);
+
+    // Test that the 'html' option allows unsanitized HTML link text.
+    $url = new Url('test_route_5', array(), array('html' => TRUE));
+    $url->setUrlGenerator($this->urlGenerator);
+    $result = $this->linkGenerator->generate('<em>HTML output</em>', $url);
+    $this->assertTag(array(
+      'tag' => 'a',
+      'attributes' => array('href' => '/test-route-5'),
+      'child' => array(
+        'tag' => 'em',
+      ),
+    ), $result);
+  }
+
+  /**
+   * Tests the active class on the link method.
+   *
+   * @see \Drupal\Core\Render\LinkGenerator::generate()
+   *
+   * @todo Test that the active class is added on the front page when generating
+   *   links to the front page when drupal_is_front_page() is converted to a
+   *   service.
+   */
+  public function testGenerateActive() {
+    $this->urlGenerator->expects($this->exactly(5))
+      ->method('generateFromRoute')
+      ->will($this->returnValueMap(array(
+        array('test_route_1', array(), FALSE, '/test-route-1'),
+        array('test_route_3', array(), FALSE, '/test-route-3'),
+        array('test_route_4', array('object' => '1'), FALSE, '/test-route-4/1'),
+      )));
+
+    $this->urlGenerator->expects($this->exactly(4))
+      ->method('getPathFromRoute')
+      ->will($this->returnValueMap(array(
+        array('test_route_1', array(), 'test-route-1'),
+        array('test_route_3', array(), 'test-route-3'),
+        array('test_route_4', array('object' => '1'), 'test-route-4/1'),
+      )));
+
+    $this->moduleHandler->expects($this->exactly(5))
+      ->method('alter');
+
+    // Render a link.
+    $url = new Url('test_route_1', array(), array('set_active_class' => TRUE));
+    $url->setUrlGenerator($this->urlGenerator);
+    $result = $this->linkGenerator->generate('Test', $url);
+    $this->assertTag(array(
+      'tag' => 'a',
+      'attributes' => array('data-drupal-link-system-path' => 'test-route-1'),
+    ), $result);
+
+    // Render a link with the set_active_class option disabled.
+    $url = new Url('test_route_1', array(), array('set_active_class' => FALSE));
+    $url->setUrlGenerator($this->urlGenerator);
+    $result = $this->linkGenerator->generate('Test', $url);
+    $this->assertNotTag(array(
+      'tag' => 'a',
+      'attributes' => array('data-drupal-link-system-path' => 'test-route-1'),
+    ), $result);
+
+    // Render a link with an associated language.
+    $url = new Url('test_route_1', array(), array(
+      'language' => new Language(array('id' => 'de')),
+      'set_active_class' => TRUE,
+    ));
+    $url->setUrlGenerator($this->urlGenerator);
+    $result = $this->linkGenerator->generate('Test', $url);
+    $this->assertTag(array(
+      'tag' => 'a',
+      'attributes' => array(
+        'data-drupal-link-system-path' => 'test-route-1',
+        'hreflang' => 'de',
+      ),
+    ), $result);
+
+    // Render a link with a query parameter.
+    $url = new Url('test_route_3', array(), array(
+      'query' => array('value' => 'example_1'),
+      'set_active_class' => TRUE,
+    ));
+    $url->setUrlGenerator($this->urlGenerator);
+    $result = $this->linkGenerator->generate('Test', $url);
+    $this->assertTag(array(
+      'tag' => 'a',
+      'attributes' => array(
+        'data-drupal-link-system-path' => 'test-route-3',
+        'data-drupal-link-query' => 'regexp:/.*value.*example_1.*/',
+      ),
+    ), $result);
+
+    // Render a link with route parameters and a query parameter.
+    $url = new Url('test_route_4', array('object' => '1'), array(
+      'query' => array('value' => 'example_1'),
+      'set_active_class' => TRUE,
+    ));
+    $url->setUrlGenerator($this->urlGenerator);
+    $result = $this->linkGenerator->generate('Test', $url);
+    $this->assertTag(array(
+      'tag' => 'a',
+      'attributes' => array(
+        'data-drupal-link-system-path' => 'test-route-4/1',
+        'data-drupal-link-query' => 'regexp:/.*value.*example_1.*/',
+      ),
+    ), $result);
+  }
+
+}
+
+}
+namespace {
+  // @todo Remove this once there is a service for drupal_is_front_page().
+  if (!function_exists('drupal_is_front_page')) {
+    function drupal_is_front_page() {
+      return FALSE;
+    }
+  }
+}
diff --git a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php b/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php
deleted file mode 100644
index 1f371fa..0000000
--- a/core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php
+++ /dev/null
@@ -1,463 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Tests\Core\Utility\LinkGeneratorTest.
- */
-
-namespace Drupal\Tests\Core\Utility {
-
-use Drupal\Core\Language\Language;
-use Drupal\Core\Url;
-use Drupal\Core\Utility\LinkGenerator;
-use Drupal\Tests\UnitTestCase;
-
-/**
- * @coversDefaultClass \Drupal\Core\Utility\LinkGenerator
- * @group Utility
- */
-class LinkGeneratorTest extends UnitTestCase {
-
-  /**
-   * The tested link generator.
-   *
-   * @var \Drupal\Core\Utility\LinkGenerator
-   */
-  protected $linkGenerator;
-
-  /**
-   * The mocked url generator.
-   *
-   * @var \PHPUnit_Framework_MockObject_MockObject
-   */
-  protected $urlGenerator;
-
-  /**
-   * The mocked module handler.
-   *
-   * @var \PHPUnit_Framework_MockObject_MockObject
-   */
-  protected $moduleHandler;
-
-  /**
-   * The mocked URL Assembler service.
-   *
-   * @var \PHPUnit_Framework_MockObject_MockObject|\Drupal\Core\Utility\UnroutedUrlAssemblerInterface
-   */
-  protected $urlAssembler;
-
-  /**
-   * Contains the LinkGenerator default options.
-   */
-  protected $defaultOptions = array(
-    'query' => array(),
-    'html' => FALSE,
-    'language' => NULL,
-    'set_active_class' => FALSE,
-    'absolute' => FALSE,
-  );
-
-  /**
-   * {@inheritdoc}
-   */
-  protected function setUp() {
-    parent::setUp();
-
-    $this->urlGenerator = $this->getMock('\Drupal\Core\Routing\UrlGenerator', array(), array(), '', FALSE);
-    $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
-
-    $this->linkGenerator = new LinkGenerator($this->urlGenerator, $this->moduleHandler);
-    $this->urlAssembler = $this->getMock('\Drupal\Core\Utility\UnroutedUrlAssemblerInterface');
-  }
-
-  /**
-   * Provides test data for testing the link method.
-   *
-   * @see \Drupal\Tests\Core\Utility\LinkGeneratorTest::testGenerateHrefs()
-   *
-   * @return array
-   *   Returns some test data.
-   */
-  public function providerTestGenerateHrefs() {
-    return array(
-      // Test that the url returned by the URL generator is used.
-      array('test_route_1', array(), FALSE, '/test-route-1'),
-        // Test that $parameters is passed to the URL generator.
-      array('test_route_2', array('value' => 'example'), FALSE, '/test-route-2/example'),
-        // Test that the 'absolute' option is passed to the URL generator.
-      array('test_route_3', array(), TRUE, 'http://example.com/test-route-3'),
-    );
-  }
-
-  /**
-   * Tests the link method with certain hrefs.
-   *
-   * @see \Drupal\Core\Utility\LinkGenerator::generate()
-   * @see \Drupal\Tests\Core\Utility\LinkGeneratorTest::providerTestGenerate()
-   *
-   * @dataProvider providerTestGenerateHrefs
-   */
-  public function testGenerateHrefs($route_name, array $parameters, $absolute, $expected_url) {
-    $this->urlGenerator->expects($this->once())
-      ->method('generateFromRoute')
-      ->with($route_name, $parameters, array('absolute' => $absolute) + $this->defaultOptions)
-      ->will($this->returnValue($expected_url));
-
-    $this->moduleHandler->expects($this->once())
-      ->method('alter');
-
-    $url = new Url($route_name, $parameters, array('absolute' => $absolute));
-    $url->setUrlGenerator($this->urlGenerator);
-    $result = $this->linkGenerator->generate('Test', $url);
-    $this->assertTag(array(
-      'tag' => 'a',
-      'attributes' => array('href' => $expected_url),
-      ), $result);
-  }
-
-  /**
-   * Tests the generate() method with a route.
-   *
-   * @covers ::generate
-   */
-  public function testGenerate() {
-    $this->urlGenerator->expects($this->once())
-      ->method('generateFromRoute')
-      ->with('test_route_1', array(), array('fragment' => 'the-fragment') + $this->defaultOptions)
-      ->will($this->returnValue('/test-route-1#the-fragment'));
-
-    $this->moduleHandler->expects($this->once())
-      ->method('alter')
-      ->with('link', $this->isType('array'));
-
-    $url = new Url('test_route_1', array(), array('fragment' => 'the-fragment'));
-    $url->setUrlGenerator($this->urlGenerator);
-
-    $result = $this->linkGenerator->generate('Test', $url);
-    $this->assertTag(array(
-      'tag' => 'a',
-      'attributes' => array(
-        'href' => '/test-route-1#the-fragment',
-      ),
-      'content' => 'Test',
-    ), $result);
-  }
-
-  /**
-   * Tests the generate() method with an external URL.
-   *
-   * The set_active_class option is set to TRUE to ensure this does not cause
-   * an error together with an external URL.
-   *
-   * @covers ::generate
-   */
-  public function testGenerateExternal() {
-    $this->urlAssembler->expects($this->once())
-      ->method('assemble')
-      ->with('http://drupal.org', array('set_active_class' => TRUE, 'external' => TRUE) + $this->defaultOptions)
-      ->will($this->returnArgument(0));
-
-    $this->moduleHandler->expects($this->once())
-      ->method('alter')
-      ->with('link', $this->isType('array'));
-
-    $this->urlAssembler->expects($this->once())
-      ->method('assemble')
-      ->with('http://drupal.org', array('set_active_class' => TRUE, 'external' => TRUE) + $this->defaultOptions)
-      ->willReturnArgument(0);
-
-    $url = Url::fromUri('http://drupal.org');
-    $url->setUrlGenerator($this->urlGenerator);
-    $url->setUnroutedUrlAssembler($this->urlAssembler);
-    $url->setOption('set_active_class', TRUE);
-
-    $result = $this->linkGenerator->generate('Drupal', $url);
-    $this->assertTag(array(
-      'tag' => 'a',
-      'attributes' => array(
-        'href' => 'http://drupal.org',
-      ),
-      'content' => 'Drupal',
-    ), $result);
-  }
-
-  /**
-   * Tests the link method with additional attributes.
-   *
-   * @see \Drupal\Core\Utility\LinkGenerator::generate()
-   */
-  public function testGenerateAttributes() {
-    $this->urlGenerator->expects($this->once())
-      ->method('generateFromRoute')
-      ->with('test_route_1', array(), $this->defaultOptions)
-      ->will($this->returnValue(
-        '/test-route-1'
-      ));
-
-    // Test that HTML attributes are added to the anchor.
-    $url = new Url('test_route_1', array(), array(
-      'attributes' => array('title' => 'Tooltip'),
-    ));
-    $url->setUrlGenerator($this->urlGenerator);
-    $result = $this->linkGenerator->generate('Test', $url);
-    $this->assertTag(array(
-      'tag' => 'a',
-      'attributes' => array(
-        'href' => '/test-route-1',
-        'title' => 'Tooltip',
-      ),
-    ), $result);
-  }
-
-  /**
-   * Tests the link method with passed query options.
-   *
-   * @see \Drupal\Core\Utility\LinkGenerator::generate()
-   */
-  public function testGenerateQuery() {
-    $this->urlGenerator->expects($this->once())
-      ->method('generateFromRoute')
-      ->with('test_route_1', array(), array('query' => array('test' => 'value')) + $this->defaultOptions)
-      ->will($this->returnValue(
-        '/test-route-1?test=value'
-      ));
-
-    $url = new Url('test_route_1', array(), array(
-      'query' => array('test' => 'value'),
-    ));
-    $url->setUrlGenerator($this->urlGenerator);
-    $result = $this->linkGenerator->generate('Test', $url);
-    $this->assertTag(array(
-      'tag' => 'a',
-      'attributes' => array(
-        'href' => '/test-route-1?test=value',
-      ),
-    ), $result);
-  }
-
-  /**
-   * Tests the link method with passed query options via parameters.
-   *
-   * @see \Drupal\Core\Utility\LinkGenerator::generate()
-   */
-  public function testGenerateParametersAsQuery() {
-    $this->urlGenerator->expects($this->once())
-      ->method('generateFromRoute')
-      ->with('test_route_1', array('test' => 'value'), $this->defaultOptions)
-      ->will($this->returnValue(
-        '/test-route-1?test=value'
-      ));
-
-    $url = new Url('test_route_1', array('test' => 'value'), array());
-    $url->setUrlGenerator($this->urlGenerator);
-    $result = $this->linkGenerator->generate('Test', $url);
-    $this->assertTag(array(
-      'tag' => 'a',
-      'attributes' => array(
-        'href' => '/test-route-1?test=value',
-      ),
-    ), $result);
-  }
-
-  /**
-   * Tests the link method with arbitrary passed options.
-   *
-   * @see \Drupal\Core\Utility\LinkGenerator::generate()
-   */
-  public function testGenerateOptions() {
-    $this->urlGenerator->expects($this->once())
-      ->method('generateFromRoute')
-      ->with('test_route_1', array(), array('key' => 'value') + $this->defaultOptions)
-      ->will($this->returnValue(
-        '/test-route-1?test=value'
-      ));
-
-    $url = new Url('test_route_1', array(), array(
-      'key' => 'value',
-    ));
-    $url->setUrlGenerator($this->urlGenerator);
-    $result = $this->linkGenerator->generate('Test', $url);
-    $this->assertTag(array(
-      'tag' => 'a',
-      'attributes' => array(
-        'href' => '/test-route-1?test=value',
-      ),
-    ), $result);
-  }
-
-  /**
-   * Tests the link method with a script tab.
-   *
-   * @see \Drupal\Core\Utility\LinkGenerator::generate()
-   */
-  public function testGenerateXss() {
-    $this->urlGenerator->expects($this->once())
-      ->method('generateFromRoute')
-      ->with('test_route_4', array(), $this->defaultOptions)
-      ->will($this->returnValue(
-        '/test-route-4'
-      ));
-
-    // Test that HTML link text is escaped by default.
-    $url = new Url('test_route_4');
-    $url->setUrlGenerator($this->urlGenerator);
-    $result = $this->linkGenerator->generate("<script>alert('XSS!')</script>", $url);
-    $this->assertNotTag(array(
-      'tag' => 'a',
-      'attributes' => array('href' => '/test-route-4'),
-      'child' => array(
-        'tag' => 'script',
-      ),
-    ), $result);
-  }
-
-  /**
-   * Tests the link method with html.
-   *
-   * @see \Drupal\Core\Utility\LinkGenerator::generate()
-   */
-  public function testGenerateWithHtml() {
-    $this->urlGenerator->expects($this->at(0))
-      ->method('generateFromRoute')
-      ->with('test_route_5', array(), $this->defaultOptions)
-      ->will($this->returnValue(
-        '/test-route-5'
-      ));
-    $this->urlGenerator->expects($this->at(1))
-      ->method('generateFromRoute')
-      ->with('test_route_5', array(), array('html' => TRUE) + $this->defaultOptions)
-      ->will($this->returnValue(
-        '/test-route-5'
-      ));
-
-    // Test that HTML tags are stripped from the 'title' attribute.
-    $url = new Url('test_route_5', array(), array(
-      'attributes' => array('title' => '<em>HTML Tooltip</em>'),
-    ));
-    $url->setUrlGenerator($this->urlGenerator);
-    $result = $this->linkGenerator->generate('Test', $url);
-    $this->assertTag(array(
-      'tag' => 'a',
-      'attributes' => array(
-        'href' => '/test-route-5',
-        'title' => 'HTML Tooltip',
-      ),
-    ), $result);
-
-    // Test that the 'html' option allows unsanitized HTML link text.
-    $url = new Url('test_route_5', array(), array('html' => TRUE));
-    $url->setUrlGenerator($this->urlGenerator);
-    $result = $this->linkGenerator->generate('<em>HTML output</em>', $url);
-    $this->assertTag(array(
-      'tag' => 'a',
-      'attributes' => array('href' => '/test-route-5'),
-      'child' => array(
-        'tag' => 'em',
-      ),
-    ), $result);
-  }
-
-  /**
-   * Tests the active class on the link method.
-   *
-   * @see \Drupal\Core\Utility\LinkGenerator::generate()
-   *
-   * @todo Test that the active class is added on the front page when generating
-   *   links to the front page when drupal_is_front_page() is converted to a
-   *   service.
-   */
-  public function testGenerateActive() {
-    $this->urlGenerator->expects($this->exactly(5))
-      ->method('generateFromRoute')
-      ->will($this->returnValueMap(array(
-        array('test_route_1', array(), FALSE, '/test-route-1'),
-        array('test_route_3', array(), FALSE, '/test-route-3'),
-        array('test_route_4', array('object' => '1'), FALSE, '/test-route-4/1'),
-      )));
-
-    $this->urlGenerator->expects($this->exactly(4))
-      ->method('getPathFromRoute')
-      ->will($this->returnValueMap(array(
-        array('test_route_1', array(), 'test-route-1'),
-        array('test_route_3', array(), 'test-route-3'),
-        array('test_route_4', array('object' => '1'), 'test-route-4/1'),
-      )));
-
-    $this->moduleHandler->expects($this->exactly(5))
-      ->method('alter');
-
-    // Render a link.
-    $url = new Url('test_route_1', array(), array('set_active_class' => TRUE));
-    $url->setUrlGenerator($this->urlGenerator);
-    $result = $this->linkGenerator->generate('Test', $url);
-    $this->assertTag(array(
-      'tag' => 'a',
-      'attributes' => array('data-drupal-link-system-path' => 'test-route-1'),
-    ), $result);
-
-    // Render a link with the set_active_class option disabled.
-    $url = new Url('test_route_1', array(), array('set_active_class' => FALSE));
-    $url->setUrlGenerator($this->urlGenerator);
-    $result = $this->linkGenerator->generate('Test', $url);
-    $this->assertNotTag(array(
-      'tag' => 'a',
-      'attributes' => array('data-drupal-link-system-path' => 'test-route-1'),
-    ), $result);
-
-    // Render a link with an associated language.
-    $url = new Url('test_route_1', array(), array(
-      'language' => new Language(array('id' => 'de')),
-      'set_active_class' => TRUE,
-    ));
-    $url->setUrlGenerator($this->urlGenerator);
-    $result = $this->linkGenerator->generate('Test', $url);
-    $this->assertTag(array(
-      'tag' => 'a',
-      'attributes' => array(
-        'data-drupal-link-system-path' => 'test-route-1',
-        'hreflang' => 'de',
-      ),
-    ), $result);
-
-    // Render a link with a query parameter.
-    $url = new Url('test_route_3', array(), array(
-      'query' => array('value' => 'example_1'),
-      'set_active_class' => TRUE,
-    ));
-    $url->setUrlGenerator($this->urlGenerator);
-    $result = $this->linkGenerator->generate('Test', $url);
-    $this->assertTag(array(
-      'tag' => 'a',
-      'attributes' => array(
-        'data-drupal-link-system-path' => 'test-route-3',
-        'data-drupal-link-query' => 'regexp:/.*value.*example_1.*/',
-      ),
-    ), $result);
-
-    // Render a link with route parameters and a query parameter.
-    $url = new Url('test_route_4', array('object' => '1'), array(
-      'query' => array('value' => 'example_1'),
-      'set_active_class' => TRUE,
-    ));
-    $url->setUrlGenerator($this->urlGenerator);
-    $result = $this->linkGenerator->generate('Test', $url);
-    $this->assertTag(array(
-      'tag' => 'a',
-      'attributes' => array(
-        'data-drupal-link-system-path' => 'test-route-4/1',
-        'data-drupal-link-query' => 'regexp:/.*value.*example_1.*/',
-      ),
-    ), $result);
-  }
-
-}
-
-}
-namespace {
-  // @todo Remove this once there is a service for drupal_is_front_page().
-  if (!function_exists('drupal_is_front_page')) {
-    function drupal_is_front_page() {
-      return FALSE;
-    }
-  }
-}
