diff --git a/core/modules/system/tests/modules/menu_test/menu_test.links.menu.yml b/core/modules/system/tests/modules/menu_test/menu_test.links.menu.yml
index 613bc92..c08ee8a 100644
--- a/core/modules/system/tests/modules/menu_test/menu_test.links.menu.yml
+++ b/core/modules/system/tests/modules/menu_test/menu_test.links.menu.yml
@@ -80,6 +80,11 @@ menu_test.child:
   route_name: menu_test.menu_name_test
   parent: menu_test.parent
 
+menu_test.access_check:
+  title: 'Test custom route access check'
+  route_name: menu_test.router_test_session
+  menu_name: account
+
 menu_test.unsafe:
   route_name: menu_test.menu_name_test
   deriver: '\Drupal\menu_test\Plugin\Derivative\MenuLinkTestWithUnsafeTitle'
diff --git a/core/modules/system/tests/modules/menu_test/menu_test.routing.yml b/core/modules/system/tests/modules/menu_test/menu_test.routing.yml
index b69d722..46287f2 100644
--- a/core/modules/system/tests/modules/menu_test/menu_test.routing.yml
+++ b/core/modules/system/tests/modules/menu_test/menu_test.routing.yml
@@ -67,6 +67,15 @@ menu_test.router_test3:
   requirements:
     _access: 'FALSE'
 
+menu_test.router_test_session:
+  path: '/menu_test_access_check_session'
+  defaults:
+    _controller: '\Drupal\menu_test\TestControllers::testSession'
+  options:
+    no_cache: TRUE
+  requirements:
+    _menu_test_session_access: 'TRUE'
+
 menu_test.router_test4:
   path: '/foo/{bar}/d'
   defaults:
diff --git a/core/modules/system/tests/modules/menu_test/menu_test.services.yml b/core/modules/system/tests/modules/menu_test/menu_test.services.yml
index 8841320..81f1f50 100644
--- a/core/modules/system/tests/modules/menu_test/menu_test.services.yml
+++ b/core/modules/system/tests/modules/menu_test/menu_test.services.yml
@@ -3,3 +3,8 @@ services:
     class: Drupal\menu_test\Theme\TestThemeNegotiator
     tags:
       - { name: theme_negotiator }
+
+  access_check.menu_test_session:
+    class: Drupal\menu_test\Access\AccessCheck
+    tags:
+      - { name: access_check, applies_to: _menu_test_session_access }
diff --git a/core/modules/system/tests/modules/menu_test/src/Access/AccessCheck.php b/core/modules/system/tests/modules/menu_test/src/Access/AccessCheck.php
new file mode 100644
index 0000000..c6b9054
--- /dev/null
+++ b/core/modules/system/tests/modules/menu_test/src/Access/AccessCheck.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * @file
+ * Contains \Drupal\menu_test\Access\AccessCheck.
+ */
+
+namespace Drupal\menu_test\Access;
+
+use Drupal\Core\Access\AccessResult;
+use Drupal\Core\Routing\Access\AccessInterface;
+
+/**
+ * Checks access based on the 'menu_test' key in session.
+ */
+class AccessCheck implements AccessInterface {
+
+  /**
+   * Check to see if user accessed this page.
+   *
+   * @return \Drupal\Core\Access\AccessResultInterface
+   *   The access result.
+   */
+  public function access() {
+    if (!isset($_SESSION['menu_test'])) {
+      $result = AccessResult::allowed();
+    }
+    else {
+      $result = AccessResult::allowedIf($_SESSION['menu_test'] < 2);
+    }
+    return $result->setCacheMaxAge(0);
+  }
+
+}
diff --git a/core/modules/system/tests/modules/menu_test/src/TestControllers.php b/core/modules/system/tests/modules/menu_test/src/TestControllers.php
index f3ff8d2..3bace32 100644
--- a/core/modules/system/tests/modules/menu_test/src/TestControllers.php
+++ b/core/modules/system/tests/modules/menu_test/src/TestControllers.php
@@ -39,6 +39,17 @@ public function test2() {
   /**
    * Prints out test data.
    */
+  public function testSession() {
+    if (!isset($_SESSION['menu_test'])) {
+      $_SESSION['menu_test'] = 0;
+    }
+    $_SESSION['menu_test']++;
+    return ['#markup' => SafeMarkup::format('Session menu_test is @count', ['@count' => $_SESSION['menu_test']])];
+  }
+
+  /**
+   * Prints out test data.
+   */
   public function testDerived() {
     return ['#markup' => 'testDerived'];
   }
