diff --git a/core/core.services.yml b/core/core.services.yml
index 18d34b9..86f8f63 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -112,7 +112,7 @@ services:
     calls:
       - [setContainer, ['@service_container']]
   cache_contexts:
-    class: Drupal\Core\Cache\CacheContexts
+    class: Drupal\Core\Cache\CacheContextsManager
     arguments: ['@service_container', '%cache_contexts%' ]
   cache_tags.invalidator:
     parent: container.trait
diff --git a/core/lib/Drupal/Core/Access/AccessResult.php b/core/lib/Drupal/Core/Access/AccessResult.php
index 6188b34..741f2ed 100644
--- a/core/lib/Drupal/Core/Access/AccessResult.php
+++ b/core/lib/Drupal/Core/Access/AccessResult.php
@@ -32,7 +32,7 @@
    * The cache context IDs (to vary a cache item ID based on active contexts).
    *
    * @see \Drupal\Core\Cache\CacheContextInterface
-   * @see \Drupal\Core\Cache\CacheContexts::convertTokensToKeys()
+   * @see \Drupal\Core\Cache\CacheContextsManager::convertTokensToKeys()
    *
    * @var string[]
    */
diff --git a/core/lib/Drupal/Core/Cache/CacheContexts.php b/core/lib/Drupal/Core/Cache/CacheContexts.php
deleted file mode 100644
index bede04d..0000000
--- a/core/lib/Drupal/Core/Cache/CacheContexts.php
+++ /dev/null
@@ -1,274 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Cache\CacheContexts.
- */
-
-namespace Drupal\Core\Cache;
-
-use Drupal\Component\Utility\SafeMarkup;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-
-/**
- * Converts cache context tokens into cache keys.
- *
- * Uses cache context services (services tagged with 'cache.context', and whose
- * service ID has the 'cache_context.' prefix) to dynamically generate cache
- * keys based on the request context, thus allowing developers to express the
- * state by which should varied (the current URL, language, and so on).
- *
- * Note that this maps exactly to HTTP's Vary header semantics:
- * @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.44
- *
- * @see \Drupal\Core\Cache\CacheContextInterface
- * @see \Drupal\Core\Cache\CalculatedCacheContextInterface
- * @see \Drupal\Core\Cache\CacheContextsPass
- */
-class CacheContexts {
-
-  /**
-   * The service container.
-   *
-   * @var \Symfony\Component\DependencyInjection\ContainerInterface
-   */
-  protected $container;
-
-  /**
-   * Available cache context IDs and corresponding labels.
-   *
-   * @var string[]
-   */
-  protected $contexts;
-
-  /**
-   * Constructs a CacheContexts object.
-   *
-   * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
-   *   The current service container.
-   * @param string[] $contexts
-   *   An array of the available cache context IDs.
-   */
-  public function __construct(ContainerInterface $container, array $contexts) {
-    $this->container = $container;
-    $this->contexts = $contexts;
-  }
-
-  /**
-   * Provides an array of available cache contexts.
-   *
-   * @return string[]
-   *   An array of available cache context IDs.
-   */
-  public function getAll() {
-    return $this->contexts;
-  }
-
-  /**
-   * Provides an array of available cache context labels.
-   *
-   * To be used in cache configuration forms.
-   *
-   * @param bool $include_calculated_cache_contexts
-   *   Whether to also return calculated cache contexts. Default to FALSE.
-   *
-   * @return array
-   *   An array of available cache contexts and corresponding labels.
-   */
-  public function getLabels($include_calculated_cache_contexts = FALSE) {
-    $with_labels = array();
-    foreach ($this->contexts as $context) {
-      $service = $this->getService($context);
-      if (!$include_calculated_cache_contexts && $service instanceof CalculatedCacheContextInterface) {
-        continue;
-      }
-      $with_labels[$context] = $service->getLabel();
-    }
-    return $with_labels;
-  }
-
-  /**
-   * Converts cache context tokens to cache keys.
-   *
-   * A cache context token is either:
-   * - a cache context ID (if the service ID is 'cache_context.foo', then 'foo'
-   *   is a cache context ID), e.g. 'foo'
-   * - a calculated cache context ID, followed by a double colon, followed by
-   *   the parameter for the calculated cache context, e.g. 'bar:some_parameter'
-   *
-   * @param string[] $context_tokens
-   *   An array of cache context tokens.
-   *
-   * @return string[]
-   *   The array of corresponding cache keys.
-   *
-   * @throws \InvalidArgumentException
-   */
-  public function convertTokensToKeys(array $context_tokens) {
-    $context_tokens = $this->optimizeTokens($context_tokens);
-    sort($context_tokens);
-    $keys = [];
-    foreach (static::parseTokens($context_tokens) as $context) {
-      list($context_id, $parameter) = $context;
-      if (!in_array($context_id, $this->contexts)) {
-        throw new \InvalidArgumentException(SafeMarkup::format('"@context" is not a valid cache context ID.', ['@context' => $context_id]));
-      }
-      $keys[] = $this->getService($context_id)->getContext($parameter);
-    }
-    return $keys;
-  }
-
-  /**
-   * Optimizes cache context tokens (the minimal representative subset).
-   *
-   * A minimal representative subset means that any cache context token in the
-   * given set of cache context tokens that is a property of another cache
-   * context cache context token in the set, is removed.
-   *
-   * Hence a minimal representative subset is the most compact representation
-   * possible of a set of cache context tokens, that still captures the entire
-   * universe of variations.
-   *
-   * E.g. when caching per user ('user'), also caching per role ('user.roles')
-   * is meaningless because "per role" is implied by "per user".
-   *
-   * Examples — remember that the period indicates hierarchy and the colon can
-   * be used to get a specific value of a calculated cache context:
-   * - ['a', 'a.b'] -> ['a']
-   * - ['a', 'a.b.c'] -> ['a']
-   * - ['a.b', 'a.b.c'] -> ['a.b']
-   * - ['a', 'a.b', 'a.b.c'] -> ['a']
-   * - ['x', 'x:foo'] -> ['x']
-   * - ['a', 'a.b.c:bar'] -> ['a']
-   *
-   * @param string[] $context_tokens
-   *   A set of cache context tokens.
-   *
-   * @return string[]
-   *   A representative subset of the given set of cache context tokens..
-   */
-  public function optimizeTokens(array $context_tokens) {
-    $optimized_content_tokens = [];
-    foreach ($context_tokens as $context_token) {
-      // Context tokens without:
-      // - a period means they don't have a parent
-      // - a colon means they're not a specific value of a cache context
-      // hence no optimizations are possible.
-      if (strpos($context_token, '.') === FALSE && strpos($context_token, ':') === FALSE) {
-        $optimized_content_tokens[] = $context_token;
-      }
-      // The context token has a period or a colon. Iterate over all ancestor
-      // cache contexts. If one exists, omit the context token.
-      else {
-        $ancestor_found = FALSE;
-        // Treat a colon like a period, that allows us to consider 'a' the
-        // ancestor of 'a:foo', without any additional code for the colon.
-        $ancestor = str_replace(':', '.', $context_token);
-        do {
-          $ancestor = substr($ancestor, 0, strrpos($ancestor, '.'));
-          if (in_array($ancestor, $context_tokens)) {
-            // An ancestor cache context is in $context_tokens, hence this cache
-            // context is implied.
-            $ancestor_found = TRUE;
-          }
-
-        } while(!$ancestor_found && strpos($ancestor, '.') !== FALSE);
-        if (!$ancestor_found) {
-          $optimized_content_tokens[] = $context_token;
-        }
-      }
-    }
-    return $optimized_content_tokens;
-  }
-
-  /**
-   * Retrieves a cache context service from the container.
-   *
-   * @param string $context_id
-   *   The context ID, which together with the service ID prefix allows the
-   *   corresponding cache context service to be retrieved.
-   *
-   * @return \Drupal\Core\Cache\CacheContextInterface
-   *   The requested cache context service.
-   */
-  protected function getService($context_id) {
-    return $this->container->get('cache_context.' . $context_id);
-  }
-
-  /**
-   * Parses cache context tokens into context IDs and optional parameters.
-   *
-   * @param string[] $context_tokens
-   *   An array of cache context tokens.
-   *
-   * @return array
-   *   An array with the parsed results, with each result being an array
-   *   containing:
-   *   - The cache context ID.
-   *   - The associated parameter (for a calculated cache context), or NULL if
-   *     there is no parameter.
-   */
-  public static function parseTokens(array $context_tokens) {
-    $contexts_with_parameters = [];
-    foreach ($context_tokens as $context) {
-      $context_id = $context;
-      $parameter = NULL;
-      if (strpos($context, ':') !== FALSE) {
-        list($context_id, $parameter) = explode(':', $context, 2);
-      }
-      $contexts_with_parameters[] = [$context_id, $parameter];
-    }
-    return $contexts_with_parameters;
-  }
-
-  /**
-   * Validates an array of cache context tokens.
-   *
-   * Can be called before using cache contexts in operations, to check validity.
-   *
-   * @param string[] $context_tokens
-   *   An array of cache context tokens.
-   *
-   * @throws \LogicException
-   *
-   * @see \Drupal\Core\Cache\CacheContexts::parseTokens()
-   */
-  public function validateTokens(array $context_tokens = []) {
-    if (empty($context_tokens)) {
-      return;
-    }
-
-    // Initialize the set of valid context tokens with the container's contexts.
-    if (!isset($this->validContextTokens)) {
-      $this->validContextTokens = array_flip($this->contexts);
-    }
-
-    foreach ($context_tokens as $context_token) {
-      if (!is_string($context_token)) {
-        throw new \LogicException(sprintf('Cache contexts must be strings, %s given.', gettype($context_token)));
-      }
-
-      if (isset($this->validContextTokens[$context_token])) {
-        continue;
-      }
-
-      // If it's a valid context token, then the ID must be stored in the set
-      // of valid context tokens (since we initialized it with the list of cache
-      // context IDs using the container). In case of an invalid context token,
-      // throw an exception, otherwise cache it, including the parameter, to
-      // minimize the amount of work in future ::validateContexts() calls.
-      $context_id = $context_token;
-      $colon_pos = strpos($context_id, ':');
-      if ($colon_pos !== FALSE) {
-        $context_id = substr($context_id, 0, $colon_pos);
-      }
-      if (isset($this->validContextTokens[$context_id])) {
-        $this->validContextTokens[$context_token] = TRUE;
-      }
-      else {
-        throw new \LogicException(sprintf('"%s" is not a valid cache context ID.', $context_id));
-      }
-    }
-  }
-
-}
diff --git a/core/lib/Drupal/Core/Cache/CacheableDependencyInterface.php b/core/lib/Drupal/Core/Cache/CacheableDependencyInterface.php
index 1d447a1..4551449 100644
--- a/core/lib/Drupal/Core/Cache/CacheableDependencyInterface.php
+++ b/core/lib/Drupal/Core/Cache/CacheableDependencyInterface.php
@@ -31,7 +31,7 @@
    * @return string[]
    *   An array of cache context tokens, used to generate a cache ID.
    *
-   * @see \Drupal\Core\Cache\CacheContexts::convertTokensToKeys()
+   * @see \Drupal\Core\Cache\CacheContextsManager::convertTokensToKeys()
    */
   public function getCacheContexts();
 
diff --git a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php
index 157454d..cd9988a 100644
--- a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php
+++ b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php
@@ -10,7 +10,7 @@
 use Drupal\Component\Datetime\DateTimePlus;
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\Cache\CacheableDependencyInterface;
-use Drupal\Core\Cache\CacheContexts;
+use Drupal\Core\Cache\CacheContextsManager;
 use Drupal\Core\Config\Config;
 use Drupal\Core\Config\ConfigFactoryInterface;
 use Drupal\Core\Language\LanguageManagerInterface;
@@ -63,7 +63,7 @@ class FinishResponseSubscriber implements EventSubscriberInterface {
   /**
    * The cache contexts service.
    *
-   * @var \Drupal\Core\Cache\CacheContexts
+   * @var \Drupal\Core\Cache\CacheContextsManager
    */
   protected $cacheContexts;
 
@@ -78,15 +78,15 @@ class FinishResponseSubscriber implements EventSubscriberInterface {
    *   A policy rule determining the cacheability of a request.
    * @param \Drupal\Core\PageCache\ResponsePolicyInterface $response_policy
    *   A policy rule determining the cacheability of a response.
-   * @param \Drupal\Core\Cache\CacheContexts $cache_contexts
+   * @param \Drupal\Core\Cache\CacheContextsManager $cache_contexts
    *   The cache contexts service.
    */
-  public function __construct(LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory, RequestPolicyInterface $request_policy, ResponsePolicyInterface $response_policy, CacheContexts $cache_contexts) {
+  public function __construct(LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory, RequestPolicyInterface $request_policy, ResponsePolicyInterface $response_policy, CacheContextsManager $cache_contexts) {
     $this->languageManager = $language_manager;
     $this->config = $config_factory->get('system.performance');
     $this->requestPolicy = $request_policy;
     $this->responsePolicy = $response_policy;
-    $this->cacheContexts = $cache_contexts;
+    $this->CacheContextsManager = $cache_contexts;
   }
 
   /**
@@ -179,7 +179,7 @@ protected function updateDrupalCacheHeaders(Response $response, CacheableDepende
       $existing_cache_contexts = explode(' ', $response->headers->get('X-Drupal-Cache-Contexts'));
       $cache_contexts = Cache::mergeContexts($existing_cache_contexts, $cache_contexts);
     }
-    $response->headers->set('X-Drupal-Cache-Contexts', implode(' ', $this->cacheContexts->optimizeTokens($cache_contexts)));
+    $response->headers->set('X-Drupal-Cache-Contexts', implode(' ', $this->CacheContextsManager->optimizeTokens($cache_contexts)));
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php b/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php
index 8821930..598412c 100644
--- a/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php
+++ b/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php
@@ -10,7 +10,7 @@
 use Drupal\Component\Plugin\PluginManagerInterface;
 use Drupal\Component\Utility\NestedArray;
 use Drupal\Core\Cache\Cache;
-use Drupal\Core\Cache\CacheContexts;
+use Drupal\Core\Cache\CacheContextsManager;
 use Drupal\Core\Controller\TitleResolverInterface;
 use Drupal\Core\Display\PageVariantInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
@@ -75,7 +75,7 @@ class HtmlRenderer implements MainContentRendererInterface {
   /**
    * The cache contexts service.
    *
-   * @var \Drupal\Core\Cache\CacheContexts
+   * @var \Drupal\Core\Cache\CacheContextsManager
    */
   protected $cacheContexts;
 
@@ -94,17 +94,17 @@ class HtmlRenderer implements MainContentRendererInterface {
    *   The module handler.
    * @param \Drupal\Core\Render\RendererInterface $renderer
    *   The renderer service.
-   * @param \Drupal\Core\Cache\CacheContexts $cache_contexts
+   * @param \Drupal\Core\Cache\CacheContextsManager $cache_contexts
    *   The cache contexts service.
    */
-  public function __construct(TitleResolverInterface $title_resolver, PluginManagerInterface $display_variant_manager, EventDispatcherInterface $event_dispatcher, ElementInfoManagerInterface $element_info_manager, ModuleHandlerInterface $module_handler, RendererInterface $renderer, CacheContexts $cache_contexts) {
+  public function __construct(TitleResolverInterface $title_resolver, PluginManagerInterface $display_variant_manager, EventDispatcherInterface $event_dispatcher, ElementInfoManagerInterface $element_info_manager, ModuleHandlerInterface $module_handler, RendererInterface $renderer, CacheContextsManager $cache_contexts) {
     $this->titleResolver = $title_resolver;
     $this->displayVariantManager = $display_variant_manager;
     $this->eventDispatcher = $event_dispatcher;
     $this->elementInfoManager = $element_info_manager;
     $this->moduleHandler = $module_handler;
     $this->renderer = $renderer;
-    $this->cacheContexts = $cache_contexts;
+    $this->CacheContextsManager = $cache_contexts;
   }
 
   /**
@@ -171,7 +171,7 @@ public function renderResponse(array $main_content, Request $request, RouteMatch
 
     $response = new Response($content, 200,[
       'X-Drupal-Cache-Tags' => implode(' ', $cache_tags),
-      'X-Drupal-Cache-Contexts' => implode(' ', $this->cacheContexts->optimizeTokens($cache_contexts)),
+      'X-Drupal-Cache-Contexts' => implode(' ', $this->CacheContextsManager->optimizeTokens($cache_contexts)),
       'X-Generator' => 'Drupal ' . $version . ' (https://www.drupal.org)'
     ]);
     // If an explicit non-infinite max-age is specified by a part of the page,
diff --git a/core/lib/Drupal/Core/Render/Renderer.php b/core/lib/Drupal/Core/Render/Renderer.php
index 5041a78..d523c4e 100644
--- a/core/lib/Drupal/Core/Render/Renderer.php
+++ b/core/lib/Drupal/Core/Render/Renderer.php
@@ -11,7 +11,7 @@
 use Drupal\Component\Utility\NestedArray;
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\Cache\CacheableDependencyInterface;
-use Drupal\Core\Cache\CacheContexts;
+use Drupal\Core\Cache\CacheContextsManager;
 use Drupal\Core\Cache\CacheFactoryInterface;
 use Drupal\Core\Controller\ControllerResolverInterface;
 use Drupal\Core\Theme\ThemeManagerInterface;
@@ -61,7 +61,7 @@ class Renderer implements RendererInterface {
   /**
    * The cache contexts service.
    *
-   * @var \Drupal\Core\Cache\CacheContexts
+   * @var \Drupal\Core\Cache\CacheContextsManager
    */
   protected $cacheContexts;
 
@@ -92,18 +92,18 @@ class Renderer implements RendererInterface {
    *   The request stack.
    * @param \Drupal\Core\Cache\CacheFactoryInterface $cache_factory
    *   The cache factory.
-   * @param \Drupal\Core\Cache\CacheContexts $cache_contexts
+   * @param \Drupal\Core\Cache\CacheContextsManager $cache_contexts
    *   The cache contexts service.
    * @param array $renderer_config
    *   The renderer configuration array.
    */
-  public function __construct(ControllerResolverInterface $controller_resolver, ThemeManagerInterface $theme, ElementInfoManagerInterface $element_info, RequestStack $request_stack, CacheFactoryInterface $cache_factory, CacheContexts $cache_contexts, array $renderer_config) {
+  public function __construct(ControllerResolverInterface $controller_resolver, ThemeManagerInterface $theme, ElementInfoManagerInterface $element_info, RequestStack $request_stack, CacheFactoryInterface $cache_factory, CacheContextsManager $cache_contexts, array $renderer_config) {
     $this->controllerResolver = $controller_resolver;
     $this->theme = $theme;
     $this->elementInfo = $element_info;
     $this->requestStack = $request_stack;
     $this->cacheFactory = $cache_factory;
-    $this->cacheContexts = $cache_contexts;
+    $this->CacheContextsManager = $cache_contexts;
     $this->rendererConfig = $renderer_config;
   }
 
@@ -755,7 +755,7 @@ protected function createCacheID(array $elements) {
     if (isset($elements['#cache']['keys'])) {
       $cid_parts = $elements['#cache']['keys'];
       if (!empty($elements['#cache']['contexts'])) {
-        $contexts = $this->cacheContexts->convertTokensToKeys($elements['#cache']['contexts']);
+        $contexts = $this->CacheContextsManager->convertTokensToKeys($elements['#cache']['contexts']);
         $cid_parts = array_merge($cid_parts, $contexts);
       }
       return implode(':', $cid_parts);
diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheContextsTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheContextsTest.php
index 76251a1..b11e8e9 100644
--- a/core/tests/Drupal/Tests/Core/Cache/CacheContextsTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/CacheContextsTest.php
@@ -7,7 +7,7 @@
 
 namespace Drupal\Tests\Core\Cache;
 
-use Drupal\Core\Cache\CacheContexts;
+use Drupal\Core\Cache\CacheContextsManager;
 use Drupal\Core\Cache\CacheContextInterface;
 use Drupal\Core\Cache\CalculatedCacheContextInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
@@ -15,7 +15,7 @@
 use Symfony\Component\DependencyInjection\Container;
 
 /**
- * @coversDefaultClass \Drupal\Core\Cache\CacheContexts
+ * @coversDefaultClass \Drupal\Core\Cache\CacheContextsManager
  * @group Cache
  */
 class CacheContextsTest extends UnitTestCase {
@@ -37,7 +37,7 @@ public function testOptimizeTokens(array $context_tokens, array $optimized_conte
         ['a.b.c', Container::EXCEPTION_ON_INVALID_REFERENCE, new BazCacheContext()],
         ['x', Container::EXCEPTION_ON_INVALID_REFERENCE, new BazCacheContext()],
       ]));
-    $cache_contexts = new CacheContexts($container, $this->getContextsFixture());
+    $cache_contexts = new CacheContextsManager($container, $this->getContextsFixture());
 
     $this->assertSame($optimized_context_tokens, $cache_contexts->optimizeTokens($context_tokens));
   }
@@ -82,7 +82,7 @@ public function providerTestOptimizeTokens() {
    */
   public function testConvertTokensToKeys() {
     $container = $this->getMockContainer();
-    $cache_contexts = new CacheContexts($container, $this->getContextsFixture());
+    $cache_contexts = new CacheContextsManager($container, $this->getContextsFixture());
 
     $new_keys = $cache_contexts->convertTokensToKeys([
       'foo',
@@ -106,7 +106,7 @@ public function testConvertTokensToKeys() {
    */
   public function testInvalidContext() {
     $container = $this->getMockContainer();
-    $cache_contexts = new CacheContexts($container, $this->getContextsFixture());
+    $cache_contexts = new CacheContextsManager($container, $this->getContextsFixture());
 
     $cache_contexts->convertTokensToKeys(["non-cache-context"]);
   }
@@ -120,7 +120,7 @@ public function testInvalidContext() {
    */
   public function testInvalidCalculatedContext($context_token) {
     $container = $this->getMockContainer();
-    $cache_contexts = new CacheContexts($container, $this->getContextsFixture());
+    $cache_contexts = new CacheContextsManager($container, $this->getContextsFixture());
 
     $cache_contexts->convertTokensToKeys([$context_token]);
   }
@@ -136,14 +136,14 @@ public function providerTestInvalidCalculatedContext() {
   }
 
   public function testAvailableContextStrings() {
-    $cache_contexts = new CacheContexts($this->getMockContainer(), $this->getContextsFixture());
+    $cache_contexts = new CacheContextsManager($this->getMockContainer(), $this->getContextsFixture());
     $contexts = $cache_contexts->getAll();
     $this->assertEquals(array("foo", "baz"), $contexts);
   }
 
   public function testAvailableContextLabels() {
     $container = $this->getMockContainer();
-    $cache_contexts = new CacheContexts($container, $this->getContextsFixture());
+    $cache_contexts = new CacheContextsManager($container, $this->getContextsFixture());
     $labels = $cache_contexts->getLabels();
     $expected = array("foo" => "Foo");
     $this->assertEquals($expected, $labels);
@@ -205,7 +205,7 @@ public function validateTokensProvider() {
    */
   public function testValidateContexts(array $contexts, $expected_exception_message) {
     $container = new ContainerBuilder();
-    $cache_contexts = new CacheContexts($container, ['foo', 'foo.bar', 'baz']);
+    $cache_contexts = new CacheContextsManager($container, ['foo', 'foo.bar', 'baz']);
     if ($expected_exception_message !== FALSE) {
       $this->setExpectedException('LogicException', $expected_exception_message);
     }
diff --git a/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php b/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php
index 7e5abf4..874169c 100644
--- a/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php
@@ -40,7 +40,7 @@ public function testBubblingWithoutPreRender() {
     $this->elementInfo->expects($this->any())
       ->method('getInfo')
       ->willReturn([]);
-    $this->cacheContexts->expects($this->any())
+    $this->CacheContextsManager->expects($this->any())
       ->method('convertTokensToKeys')
       ->willReturnArgument(0);
 
@@ -86,7 +86,7 @@ public function testBubblingWithoutPreRender() {
   public function testContextBubblingEdgeCases(array $element, array $expected_top_level_contexts, array $expected_cache_items) {
     $this->setUpRequest();
     $this->setupMemoryCache();
-    $this->cacheContexts->expects($this->any())
+    $this->CacheContextsManager->expects($this->any())
       ->method('convertTokensToKeys')
       ->willReturnArgument(0);
 
diff --git a/core/tests/Drupal/Tests/Core/Render/RendererPostRenderCacheTest.php b/core/tests/Drupal/Tests/Core/Render/RendererPostRenderCacheTest.php
index 99a639e..01b2fc7 100644
--- a/core/tests/Drupal/Tests/Core/Render/RendererPostRenderCacheTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/RendererPostRenderCacheTest.php
@@ -195,7 +195,7 @@ public function testRenderRecursivePostRenderCache() {
   public function testRenderChildrenPostRenderCacheDifferentContexts() {
     $this->setUpRequest();
     $this->setupMemoryCache();
-    $this->cacheContexts->expects($this->any())
+    $this->CacheContextsManager->expects($this->any())
       ->method('convertTokensToKeys')
       ->willReturnArgument(0);
     $this->elementInfo->expects($this->any())
@@ -290,7 +290,7 @@ public function testRenderChildrenPostRenderCacheDifferentContexts() {
   public function testRenderChildrenPostRenderCacheComplex() {
     $this->setUpRequest();
     $this->setupMemoryCache();
-    $this->cacheContexts->expects($this->any())
+    $this->CacheContextsManager->expects($this->any())
       ->method('convertTokensToKeys')
       ->willReturnArgument(0);
     $this->elementInfo->expects($this->any())
diff --git a/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php b/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php
index 7f24130..86e5cbd 100644
--- a/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php
+++ b/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php
@@ -40,7 +40,7 @@ class RendererTestBase extends UnitTestCase {
   protected $cacheFactory;
 
   /**
-   * @var \Drupal\Core\Cache\CacheContexts|\PHPUnit_Framework_MockObject_MockObject
+   * @var \Drupal\Core\Cache\CacheContextsManager|\PHPUnit_Framework_MockObject_MockObject
    */
   protected $cacheContexts;
 
@@ -93,10 +93,10 @@ protected function setUp() {
     $this->elementInfo = $this->getMock('Drupal\Core\Render\ElementInfoManagerInterface');
     $this->requestStack = new RequestStack();
     $this->cacheFactory = $this->getMock('Drupal\Core\Cache\CacheFactoryInterface');
-    $this->cacheContexts = $this->getMockBuilder('Drupal\Core\Cache\CacheContexts')
+    $this->CacheContextsManager = $this->getMockBuilder('Drupal\Core\Cache\CacheContextsManager')
       ->disableOriginalConstructor()
       ->getMock();
-    $this->cacheContexts->expects($this->any())
+    $this->CacheContextsManager->expects($this->any())
       ->method('convertTokensToKeys')
       ->willReturnCallback(function($context_tokens) {
         global $current_user_role;
@@ -118,10 +118,10 @@ protected function setUp() {
         }
         return $keys;
       });
-    $this->renderer = new Renderer($this->controllerResolver, $this->themeManager, $this->elementInfo, $this->requestStack, $this->cacheFactory, $this->cacheContexts, $this->rendererConfig);
+    $this->renderer = new Renderer($this->controllerResolver, $this->themeManager, $this->elementInfo, $this->requestStack, $this->cacheFactory, $this->CacheContextsManager, $this->rendererConfig);
 
     $container = new ContainerBuilder();
-    $container->set('cache_contexts', $this->cacheContexts);
+    $container->set('cache_contexts', $this->CacheContextsManager);
     $container->set('renderer', $this->renderer);
     \Drupal::setContainer($container);
   }
