diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php
index ffddabb..a5f098e 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php
@@ -41,7 +41,7 @@
    */
   public function form(array $form, array &$form_state) {
     $block = $this->entity;
-    $account = \Drupal::currentUser();
+    $account = $this->getCurrentUser();
 
     if ($this->operation == 'edit') {
       // @todo Remove this once https://drupal.org/node/1981644 is in.
diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Block/CustomBlockBlock.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Block/CustomBlockBlock.php
index f6c69e6..8285dfe 100644
--- a/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Block/CustomBlockBlock.php
+++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Block/CustomBlockBlock.php
@@ -12,6 +12,7 @@
 use Drupal\Core\Annotation\Translation;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\Core\Session\AccountInterface;
 use Drupal\block\Plugin\Type\BlockManager;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 
@@ -41,6 +42,13 @@
   protected $moduleHandler;
 
   /**
+   * The Current User.
+   *
+   * @var \Drupal\Core\Session\AccountInterface.
+   */
+  protected $currentUser;
+
+  /**
    * Constructs a new CustomBlockBlock.
    *
    * @param array $configuration
@@ -53,12 +61,16 @@
    *   The Plugin Block Manager.
    * @param \Drupal\Core\Extension\ModuleHandlerInterface
    *   The Module Handler.
+   * @param \Drupal\Core\Session\AccountInterface $account
+   * (optional) The account for which view access should be checked. Defaults to
+   *   the current user.
    */
-  public function __construct(array $configuration, $plugin_id, array $plugin_definition, BlockManager $block_manager, ModuleHandlerInterface $module_handler) {
+  public function __construct(array $configuration, $plugin_id, array $plugin_definition, BlockManager $block_manager, ModuleHandlerInterface $module_handler, AccountInterface $account = NULL) {
     parent::__construct($configuration, $plugin_id, $plugin_definition);
 
     $this->blockManager = $block_manager;
     $this->moduleHandler = $module_handler;
+    $this->currentUser = $container->get('current_user',$account); 
   }
 
   /**
@@ -132,7 +144,7 @@
           '%uuid' => $uuid,
           '!url' => url('block/add')
         )),
-        '#access' => \Drupal::currentUser()->hasPermission('administer blocks')
+        '#access' => $this->currentUser->hasPermission('administer blocks')
       );
     }
   }
diff --git a/core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestBlockInstantiation.php b/core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestBlockInstantiation.php
index db402cb..347b8de 100644
--- a/core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestBlockInstantiation.php
+++ b/core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestBlockInstantiation.php
@@ -10,7 +10,6 @@
 use Drupal\block\BlockBase;
 use Drupal\block\Annotation\Block;
 use Drupal\Core\Annotation\Translation;
-use Drupal\Core\Session\AccountInterface;
 
 /**
  * Provides a basic block for testing block instantiation and configuration.
