diff --git a/core/modules/system/lib/Drupal/system/Tests/Session/SessionHttpsTest.php b/core/modules/system/lib/Drupal/system/Tests/Session/SessionHttpsTest.php
index a9c709c..858da22 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Session/SessionHttpsTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Session/SessionHttpsTest.php
@@ -18,6 +18,20 @@
 class SessionHttpsTest extends WebTestBase {
 
   /**
+   * The name of the session cookie when using HTTP.
+   *
+   * @var string
+   */
+  protected $insecureSessionName;
+
+  /**
+   * The name of the session cookie when using HTTPS.
+   *
+   * @var string
+   */
+  protected $secureSessionName;
+
+  /**
    * Modules to enable.
    *
    * @var array
@@ -34,20 +48,19 @@ public static function getInfo() {
 
   public function setUp() {
     parent::setUp();
-    $this->request = Request::createFromGlobals();
-    $this->container->set('request', $this->request);
-  }
 
-  protected function testHttpsSession() {
-    if ($this->request->isSecure()) {
-      $secure_session_name = session_name();
-      $insecure_session_name = substr(session_name(), 1);
+    $request = Request::createFromGlobals();
+    if ($request->isSecure()) {
+      $this->secureSessionName = session_name();
+      $this->insecureSessionName = substr(session_name(), 1);
     }
     else {
-      $secure_session_name = 'S' . session_name();
-      $insecure_session_name = session_name();
+      $this->secureSessionName = 'S' . session_name();
+      $this->insecureSessionName = session_name();
     }
+  }
 
+  protected function testHttpsSession() {
     $user = $this->drupalCreateUser(array('access administration pages'));
 
     // Test HTTPS session handling by altering the form action to submit the
@@ -66,12 +79,12 @@ protected function testHttpsSession() {
     $this->drupalPostForm(NULL, $edit, t('Log in'));
 
     // Check secure cookie on secure page.
-    $this->assertTrue($this->cookies[$secure_session_name]['secure'], 'The secure cookie has the secure attribute');
+    $this->assertTrue($this->cookies[$this->secureSessionName]['secure'], 'The secure cookie has the secure attribute');
     // Check insecure cookie is not set.
-    $this->assertFalse(isset($this->cookies[$insecure_session_name]));
-    $ssid = $this->cookies[$secure_session_name]['value'];
+    $this->assertFalse(isset($this->cookies[$this->insecureSessionName]));
+    $ssid = $this->cookies[$this->secureSessionName]['value'];
     $this->assertSessionIds($ssid, $ssid, 'Session has a non-empty SID and a correct secure SID.');
-    $cookie = $secure_session_name . '=' . $ssid;
+    $cookie = $this->secureSessionName . '=' . $ssid;
 
     // Verify that user is logged in on secure URL.
     $this->curlClose();
@@ -87,7 +100,7 @@ protected function testHttpsSession() {
 
     // Verify that empty SID cannot be used on the non-secure site.
     $this->curlClose();
-    $cookie = $insecure_session_name . '=';
+    $cookie = $this->insecureSessionName . '=';
     $this->drupalGet($this->httpUrl('admin/config'), array(), array('Cookie: ' . $cookie));
     $this->assertResponse(403);
 
@@ -102,12 +115,12 @@ protected function testHttpsSession() {
     $this->drupalPostForm(NULL, $edit, t('Log in'));
     $this->drupalGet($this->httpUrl('admin/config'));
     $this->assertResponse(200);
-    $sid = $this->cookies[$insecure_session_name]['value'];
+    $sid = $this->cookies[$this->insecureSessionName]['value'];
     $this->assertSessionIds($sid, '', 'Session has the correct SID and an empty secure SID.');
 
     // Verify that empty secure SID cannot be used on the secure site.
     $this->curlClose();
-    $cookie = $secure_session_name . '=';
+    $cookie = $this->secureSessionName . '=';
     $this->drupalGet($this->httpsUrl('admin/config'), array(), array('Cookie: ' . $cookie));
     $this->assertResponse(403);
 
@@ -119,15 +132,6 @@ protected function testHttpsSession() {
    * Tests sessions in SSL mixed mode.
    */
   protected function testMixedModeSslSession() {
-    if ($this->request->isSecure()) {
-      // The functionality does not make sense when running on HTTPS.
-      return;
-    }
-    else {
-      $secure_session_name = 'S' . session_name();
-      $insecure_session_name = session_name();
-    }
-
     // Enable secure pages.
     $this->settingsSet('mixed_mode_sessions', TRUE);
     // Write that value also into the test settings.php file.
@@ -142,15 +146,15 @@ protected function testMixedModeSslSession() {
     $this->curlClose();
     // Start an anonymous session on the insecure site.
     $session_data = $this->randomName();
-    $this->drupalGet('session-test/set/' . $session_data);
+    $this->drupalGet($this->httpUrl('session-test/set/') . $session_data);
     // Check secure cookie on insecure page.
-    $this->assertFalse(isset($this->cookies[$secure_session_name]), 'The secure cookie is not sent on insecure pages.');
+    $this->assertFalse(isset($this->cookies[$this->secureSessionName]), 'The secure cookie is not sent on insecure pages.');
     // Check insecure cookie on insecure page.
-    $this->assertFalse($this->cookies[$insecure_session_name]['secure'], 'The insecure cookie does not have the secure attribute');
+    $this->assertFalse($this->cookies[$this->insecureSessionName]['secure'], 'The insecure cookie does not have the secure attribute');
 
     // Store the anonymous cookie so we can validate that its session is killed
     // after login.
-    $anonymous_cookie = $insecure_session_name . '=' . $this->cookies[$insecure_session_name]['value'];
+    $anonymous_cookie = $this->insecureSessionName . '=' . $this->cookies[$this->insecureSessionName]['value'];
 
     // Check that password request form action is not secure.
     $this->drupalGet('user/password');
@@ -170,16 +174,16 @@ protected function testMixedModeSslSession() {
     );
     $this->drupalPostForm(NULL, $edit, t('Log in'));
     // Check secure cookie on secure page.
-    $this->assertTrue($this->cookies[$secure_session_name]['secure'], 'The secure cookie has the secure attribute');
+    $this->assertTrue($this->cookies[$this->secureSessionName]['secure'], 'The secure cookie has the secure attribute');
     // Check insecure cookie on secure page.
-    $this->assertFalse($this->cookies[$insecure_session_name]['secure'], 'The insecure cookie does not have the secure attribute');
+    $this->assertFalse($this->cookies[$this->insecureSessionName]['secure'], 'The insecure cookie does not have the secure attribute');
 
-    $sid = $this->cookies[$insecure_session_name]['value'];
-    $ssid = $this->cookies[$secure_session_name]['value'];
+    $sid = $this->cookies[$this->insecureSessionName]['value'];
+    $ssid = $this->cookies[$this->secureSessionName]['value'];
     $this->assertSessionIds($sid, $ssid, 'Session has both secure and insecure SIDs');
     $cookies = array(
-      $insecure_session_name . '=' . $sid,
-      $secure_session_name . '=' . $ssid,
+      $this->insecureSessionName . '=' . $sid,
+      $this->secureSessionName . '=' . $ssid,
     );
 
     // Test that session data saved before login is still available on the
@@ -188,7 +192,7 @@ protected function testMixedModeSslSession() {
     $this->assertText($session_data, 'Session correctly returned the stored data set by the anonymous session.');
 
     foreach ($cookies as $cookie_key => $cookie) {
-      foreach (array('admin/config', $this->httpsUrl('admin/config')) as $url_key => $url) {
+      foreach (array($this->httpUrl('admin/config'), $this->httpsUrl('admin/config')) as $url_key => $url) {
         $this->curlClose();
 
         $this->drupalGet($url, array(), array('Cookie: ' . $cookie));
@@ -216,13 +220,13 @@ protected function testMixedModeSslSession() {
     $this->drupalGet($this->httpsUrl('session-test/set/1'));
 
     // Mock a login to the secure site using the secure session cookie.
-    $this->drupalGet('user');
+    $this->drupalGet($this->httpsUrl('user'));
     $form = $this->xpath('//form[@id="user-login-form"]');
     $form[0]['action'] = $this->httpsUrl('user');
     $this->drupalPostForm(NULL, $edit, t('Log in'));
 
     // Test that the user is also authenticated on the insecure site.
-    $this->drupalGet("user/" . $user->id() . "/edit");
+    $this->drupalGet($this->httpUrl("user/" . $user->id() . "/edit"));
     $this->assertResponse(200);
   }
 
@@ -230,15 +234,6 @@ protected function testMixedModeSslSession() {
    * Ensure that a CSRF form token is shared in SSL mixed mode.
    */
   protected function testCsrfTokenWithMixedModeSsl() {
-    if ($this->request->isSecure()) {
-      $secure_session_name = session_name();
-      $insecure_session_name = substr(session_name(), 1);
-    }
-    else {
-      $secure_session_name = 'S' . session_name();
-      $insecure_session_name = session_name();
-    }
-
     // Enable mixed mode SSL.
     $this->settingsSet('mixed_mode_sessions', TRUE);
     // Write that value also into the test settings.php file.
@@ -258,13 +253,13 @@ protected function testCsrfTokenWithMixedModeSsl() {
     $this->drupalPostForm(NULL, $edit, t('Log in'));
 
     // Collect session id cookies.
-    $sid = $this->cookies[$insecure_session_name]['value'];
-    $ssid = $this->cookies[$secure_session_name]['value'];
+    $sid = $this->cookies[$this->insecureSessionName]['value'];
+    $ssid = $this->cookies[$this->secureSessionName]['value'];
     $this->assertSessionIds($sid, $ssid, 'Session has both secure and insecure SIDs');
 
     // Retrieve the form via HTTP.
     $this->curlClose();
-    $this->drupalGet($this->httpUrl('session-test/form'), array(), array('Cookie: ' . $insecure_session_name . '=' . $sid));
+    $this->drupalGet($this->httpUrl('session-test/form'), array(), array('Cookie: ' . $this->insecureSessionName . '=' . $sid));
     $http_token = $this->getFormToken();
 
     // Verify that submitting form values via HTTPS to a form originally
@@ -273,12 +268,12 @@ protected function testCsrfTokenWithMixedModeSsl() {
     $form[0]['action'] = $this->httpsUrl('session-test/form');
     $edit = array('input' => $this->randomName(32));
     $this->curlClose();
-    $this->drupalPostForm(NULL, $edit, 'Save', array('Cookie: ' . $secure_session_name . '=' . $ssid));
+    $this->drupalPostForm(NULL, $edit, 'Save', array('Cookie: ' . $this->secureSessionName . '=' . $ssid));
     $this->assertText(String::format('Ok: @input', array('@input' => $edit['input'])));
 
     // Retrieve the same form via HTTPS.
     $this->curlClose();
-    $this->drupalGet($this->httpsUrl('session-test/form'), array(), array('Cookie: ' . $secure_session_name . '=' . $ssid));
+    $this->drupalGet($this->httpsUrl('session-test/form'), array(), array('Cookie: ' . $this->secureSessionName . '=' . $ssid));
     $https_token = $this->getFormToken();
 
     // Verify that CSRF token values are the same for a form regardless of
@@ -328,7 +323,6 @@ protected function assertSessionIds($sid, $ssid, $assertion_text) {
    */
   protected function httpsUrl($url) {
     global $base_url;
-    $this->request->server->set('HTTPS', 'on');
     return $base_url . '/core/modules/system/tests/https.php/' . $url;
   }
 
@@ -345,4 +339,5 @@ protected function httpUrl($url) {
     global $base_url;
     return $base_url . '/core/modules/system/tests/http.php/' . $url;
   }
+
 }
