diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php
index 131ce25..95b0193 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php
@@ -24,6 +24,10 @@ class UrlTest extends WebTestBase {
     );
   }
 
+  function setUp() {
+    parent::setUp(array('common_test'));
+  }
+
   /**
    * Confirm that invalid text given as $path is filtered.
    */
@@ -35,12 +39,28 @@ class UrlTest extends WebTestBase {
     $this->assertTrue(strpos($link, $sanitized_path) !== FALSE, t('XSS attack @path was filtered', array('@path' => $path)));
   }
 
-  /*
+  /**
    * Tests for active class in l() function.
    */
   function testLActiveClass() {
-    $link = l($this->randomName(), current_path());
-    $this->assertTrue($this->hasClass($link, 'active'), t('Class @class is present on link to the current page', array('@class' => 'active')));
+    $path = 'common-test/l-active-class';
+    $options = array();
+
+    $this->drupalGet($path, $options);
+    $links = $this->xpath('//a[@href = :href and contains(@class, :class)]', array(':href' => url($path, $options), ':class' => 'active'));
+    $this->assertTrue(isset($links[0]), 'A link to the current page is marked active.');
+
+    $options = array('query' => array('foo' => 'bar'));
+    $links = $this->xpath('//a[@href = :href and not(contains(@class, :class))]', array(':href' => url($path, $options), ':class' => 'active'));
+    $this->assertTrue(isset($links[0]), 'A link to the current page with a query string when the current page has no query string is not marked active.');
+
+    $this->drupalGet($path, $options);
+    $links = $this->xpath('//a[@href = :href and contains(@class, :class)]', array(':href' => url($path, $options), ':class' => 'active'));
+    $this->assertTrue(isset($links[0]), 'A link to the current page with a query string that matches the current query string is marked active.');
+
+    $options = array();
+    $links = $this->xpath('//a[@href = :href and not(contains(@class, :class))]', array(':href' => url($path, $options), ':class' => 'active'));
+    $this->assertTrue(isset($links[0]), 'A link to the current page without a query string when the current page has a query string is not marked active.');
   }
 
   /**
diff --git a/core/modules/system/tests/modules/common_test/common_test.module b/core/modules/system/tests/modules/common_test/common_test.module
index 187fee5..de47b33 100644
--- a/core/modules/system/tests/modules/common_test/common_test.module
+++ b/core/modules/system/tests/modules/common_test/common_test.module
@@ -58,6 +58,12 @@ function common_test_menu() {
     'access arguments' => array('access content'),
     'type' => MENU_CALLBACK,
   );
+  $items['common-test/l-active-class'] = array(
+    'title' => 'Test l() adding of active class',
+    'page callback' => 'common_test_l_active_class',
+    'access arguments' => array('access content'),
+    'type' => MENU_CALLBACK,
+  );
   return $items;
 }
 
@@ -288,3 +294,26 @@ function common_test_js_and_css_querystring() {
 function common_test_cron() {
   throw new Exception(t('Uncaught exception'));
 }
+
+/**
+ * @todo.
+ */
+function common_test_l_active_class() {
+  return array(
+    'no_query' => array(
+      '#type' => 'link',
+      '#title' => t('Link with no query string'),
+      '#href' => current_path(),
+    ),
+    'with_query' => array(
+      '#type' => 'link',
+      '#title' => t('Link with a query string'),
+      '#href' => current_path(),
+      '#options' => array(
+        'query' => array(
+          'foo' => 'bar',
+        ),
+      ),
+    ),
+  );
+}
