diff --git a/core/modules/file/src/Tests/FileSelectionTest.php b/core/modules/file/src/Tests/FileSelectionTest.php
new file mode 100644
index 0000000..2943f0c
--- /dev/null
+++ b/core/modules/file/src/Tests/FileSelectionTest.php
@@ -0,0 +1,112 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\file\Tests\FileSelectionTest.
+ */
+
+namespace Drupal\file\Tests;
+
+use Drupal\Component\Utility\SafeMarkup;
+use Drupal\field\Entity\FieldConfig;
+use Drupal\field\Entity\FieldStorageConfig;
+use Drupal\file\Entity\File;
+use Drupal\simpletest\WebTestBase;
+
+/**
+ * Tests file selection plugin.
+ *
+ * @group file
+ */
+class FileSelectionTest extends WebTestBase {
+
+  public static $modules = array('entity_reference', 'entity_test', 'file');
+
+  protected function setUp() {
+    parent::setUp();
+
+    // Create a field.
+    $field_storage = FieldStorageConfig::create(array(
+      'field_name' => 'test_field',
+      'entity_type' => 'entity_test',
+      'translatable' => FALSE,
+      'settings' => array(
+        'target_type' => 'file',
+      ),
+      'type' => 'entity_reference',
+      'cardinality' => 1,
+    ));
+    $field_storage->save();
+    $field = FieldConfig::create(array(
+      'field_storage' => $field_storage,
+      'entity_type' => 'entity_test',
+      'bundle' => 'test_bundle',
+      'settings' => array(
+        'handler' => 'default',
+        'handler_settings' => array(
+          'target_bundles' => array(),
+          'sort' => array(
+            'field' => "_none"
+          )
+        ),
+      ),
+    ));
+    $field->save();
+
+    $this->handler = $this->container->get('plugin.manager.entity_reference_selection')->getSelectionHandler($field);
+  }
+
+  /**
+   * Test can refer to permanent files.
+   */
+  public function testCanReferToPermanentFiles() {
+    $expected_result = array();
+    foreach ($this->getTestFiles(TRUE) as $file) {
+      $expected_result[$file->id()] = SafeMarkup::checkPlain($file->label());
+    }
+
+    // Assert the result.
+    $result = $this->handler->getReferenceableEntities();
+    $this->assertEqual($result['file'], $expected_result, 'Permanent files can be referred by handler.');
+  }
+
+  /**
+   * Test can not refer to temporary files.
+   */
+  public function testCanNotReferToTemporaryFiles() {
+    $this->getTestFiles();
+
+    // Assert the result.
+    $result = $this->handler->getReferenceableEntities();
+    $this->assertFalse(isset($result['file']), 'Temporary files can not be referred by handler.');
+  }
+
+  /**
+   * Create file entities.
+   *
+   * @param boolean $permanent
+   * Permanent flag to create permanent file or not.
+   *
+   * @return array
+   */
+  public function getTestFiles($permanent = FALSE) {
+    $files = array();
+    foreach ($this->drupalGetTestFiles('text') as $data) {
+
+      // Add a filesize property to files as would be read by file_load().
+      $data->filesize = filesize($data->uri);
+
+      if ($permanent) {
+        // Only permanent files can work with file selection handler.
+        $data->status = FILE_STATUS_PERMANENT;
+      }
+
+      $file = File::create((array) $data);
+      $file->save();
+      $files[] = $file;
+    }
+
+    return $files;
+  }
+
+}
