diff --git a/core/lib/Drupal/Core/Theme/Registry.php b/core/lib/Drupal/Core/Theme/Registry.php
index ff4f678..37c6022 100644
--- a/core/lib/Drupal/Core/Theme/Registry.php
+++ b/core/lib/Drupal/Core/Theme/Registry.php
@@ -350,9 +350,9 @@ protected function build() {
     // Finally, hooks provided by the theme itself.
     $this->processExtension($cache, $this->theme->getName(), 'theme', $this->theme->getName(), $this->theme->getPath());
 
-    // Let modules alter the registry.
+    // Let themes and modules alter the registry.
     $this->moduleHandler->alter('theme_registry', $cache);
-    // @todo Do we want to allow themes to take part?
+    \Drupal::theme()->alter('theme_registry', $cache);
 
     // @todo Implement more reduction of the theme registry entry.
     // Optimize the registry to not have empty arrays for functions.
diff --git a/core/modules/system/src/Tests/Theme/RegistryTest.php b/core/modules/system/src/Tests/Theme/RegistryTest.php
index 8851ebb..9243523 100644
--- a/core/modules/system/src/Tests/Theme/RegistryTest.php
+++ b/core/modules/system/src/Tests/Theme/RegistryTest.php
@@ -24,11 +24,44 @@ class RegistryTest extends WebTestBase {
    */
   public static $modules = array('theme_test');
 
-  protected $profile = 'testing';
+  /**
+   * The theme handler used in this test for enabling themes.
+   *
+   * @var \Drupal\Core\Extension\ThemeHandler
+   */
+  protected $themeHandler;
+
+  /**
+   * The theme manager used in this test.
+   *
+   * @var \Drupal\Core\Theme\ThemeManagerInterface
+   */
+  protected $themeManager;
+
+  /**
+   * The state service used in this test.
+   *
+   * @var \Drupal\Core\State\StateInterface
+   */
+  protected $state;
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+
+    $this->themeHandler = $this->container->get('theme_handler');
+    $this->themeManager = $this->container->get('theme.manager');
+  }
+
   /**
    * Tests the behavior of the theme registry class.
    */
   function testRaceCondition() {
+    $this->themeHandler->install(array('test_theme'));
+    $this->themeHandler->setDefault('test_theme');
+    $this->themeManager->resetActiveTheme();
     // The theme registry is not marked as persistable in case we don't have a
     // proper request.
     \Drupal::request()->setMethod('GET');
@@ -41,9 +74,10 @@ function testRaceCondition() {
     $registry = new ThemeRegistry($cid, $cache, $lock_backend, array('theme_registry'), $this->container->get('module_handler')->isLoaded());
 
     $this->assertTrue(\Drupal::cache()->get($cid), 'Cache entry was created.');
-
+    $entry = $registry->get('theme_test_template_test');
     // Trigger a cache miss for an offset.
-    $this->assertTrue($registry->get('theme_test_template_test'), 'Offset was returned correctly from the theme registry.');
+    $this->assertTrue($entry, 'Offset was returned correctly from the theme registry.');
+    $this->assertTrue(isset($entry['variables']['foo']) && $entry['variables']['foo'] == 'bar', 'Additional variable added correctly to the theme registry.');
     // This will cause the ThemeRegistry class to write an updated version of
     // the cache entry when it is destroyed, usually at the end of the request.
     // Before that happens, manually delete the cache entry we created earlier
@@ -62,4 +96,5 @@ function testRaceCondition() {
     $this->assertTrue($registry->get('theme_test_template_test'), 'Offset was returned correctly from the theme registry');
     $this->assertTrue($registry->get('theme_test_template_test_2'), 'Offset was returned correctly from the theme registry');
   }
+
 }
diff --git a/core/modules/system/tests/themes/test_theme/test_theme.theme b/core/modules/system/tests/themes/test_theme/test_theme.theme
index 013ef7d..d50d432 100644
--- a/core/modules/system/tests/themes/test_theme/test_theme.theme
+++ b/core/modules/system/tests/themes/test_theme/test_theme.theme
@@ -84,3 +84,12 @@ function test_theme_theme_test_function_suggestions__theme_override($variables)
 function test_theme_theme_test_function_suggestions__module_override($variables) {
   return 'Theme function overridden based on new theme suggestion provided by a module.';
 }
+
+/**
+ * Add a new variable to theme registry entry.
+ *
+ * Implements hook_theme_theme_registry_alter().
+ */
+function test_theme_theme_registry_alter(&$theme_registry) {
+  $theme_registry['theme_test_template_test']['variables']['foo'] = 'bar';
+}
