diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index 9780ed2..1271ef4 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -867,6 +867,12 @@ function drupal_get_filename($type, $name, $filename = NULL) {
   // drupal_static().
   static $files = array(), $dirs = array();
 
+  // Profiles are a special case: they have a fixed location and naming.
+  if ($type == 'profile') {
+    $filename = "profiles/$name/$name.profile";
+    $files[$type][$name] = file_exists($filename) ? $filename : FALSE;
+  }
+
   if (!isset($files[$type])) {
     $files[$type] = array();
   }
diff --git a/core/modules/simpletest/tests/bootstrap.test b/core/modules/simpletest/tests/bootstrap.test
index 5829222..67d41e4 100644
--- a/core/modules/simpletest/tests/bootstrap.test
+++ b/core/modules/simpletest/tests/bootstrap.test
@@ -321,26 +321,53 @@ class HookBootExitTestCase extends DrupalWebTestCase {
 }
 
 /**
- * Test drupal_get_filename()'s availability.
+ * Test drupal_get_filename()'s availability without a DB.
  */
-class BootstrapGetFilenameTestCase extends DrupalUnitTestCase {
+class BootstrapGetFilenameTestCaseNoDatabase extends DrupalUnitTestCase {
 
   public static function getInfo() {
     return array(
-      'name' => 'Get filename test',
-      'description' => 'Test that drupal_get_filename() works correctly when the file is not found in the database.',
+      'name' => 'Get filename test (no database)',
+      'description' => 'Test that drupal_get_filename() works correctly without an active database connection.',
       'group' => 'Bootstrap',
     );
   }
 
   /**
-   * Test that drupal_get_filename() works correctly when the file is not found in the database.
+   * Test that drupal_get_filename() works correctly when not using the DB.
    */
   function testDrupalGetFilename() {
-    // Reset the static cache so we can test the "db is not active" code of
-    // drupal_get_filename().
-    drupal_static_reset('drupal_get_filename');
+    // Retrieving the location of a module.
+    $this->assertIdentical(drupal_get_filename('module', 'php'), 'core/modules/php/php.module', t('Retrieve module location.'));
+
+    // Retrieving the location of a theme.
+    $this->assertIdentical(drupal_get_filename('theme', 'stark'), 'core/themes/stark/stark.info', t('Retrieve theme location.'));
+
+    // Retrieving the location of a theme engine.
+    $this->assertIdentical(drupal_get_filename('theme_engine', 'phptemplate'), 'core/themes/engines/phptemplate/phptemplate.engine', t('Retrieve theme engine location.'));
+
+    // Retrieving the location of an install profile.
+    $this->assertIdentical(drupal_get_filename('profile', 'standard'), 'profiles/standard/standard.profile', t('Retrieve install profile location.'));
+  }
+}
+
+/**
+ * Test drupal_get_filename()'s availability with a DB.
+ */
+class BootstrapGetFilenameTestCaseDatabase extends DrupalWebTestCase {
 
+  public static function getInfo() {
+    return array(
+      'name' => 'Get filename test (database)',
+      'description' => 'Test that drupal_get_filename() works correctly with an active database connection.',
+      'group' => 'Bootstrap',
+    );
+  }
+
+  /**
+   * Test that drupal_get_filename() works correctly when the file is not found in the database.
+   */
+  function testDrupalGetFilename() {
     // Retrieving the location of a module.
     $this->assertIdentical(drupal_get_filename('module', 'php'), 'core/modules/php/php.module', t('Retrieve module location.'));
 
@@ -350,11 +377,11 @@ class BootstrapGetFilenameTestCase extends DrupalUnitTestCase {
     // Retrieving the location of a theme engine.
     $this->assertIdentical(drupal_get_filename('theme_engine', 'phptemplate'), 'core/themes/engines/phptemplate/phptemplate.engine', t('Retrieve theme engine location.'));
 
-    // @todo: This test is broken because drupal_get_filename() does not work
-    // with profiles at all. See this core issue: http://drupal.org/node/1006714
+    // Retrieving the location of an install profile.
+    $this->assertIdentical(drupal_get_filename('profile', 'standard'), 'profiles/standard/standard.profile', t('Retrieve install profile location.'));
 
-    // Retrieving a file that is definitely not stored in the database.
-    //$this->assertIdentical(drupal_get_filename('profile', 'standard'), 'profiles/standard/standard.profile', t('Retrieve install profile location.'));
+    // Retrieving the location of an install profile, that isn't in the DB.
+    $this->assertIdentical(drupal_get_filename('profile', 'testing'), 'profiles/testing/testing.profile', t('Retrieve install profile location, without DB.'));
   }
 }
 
@@ -499,4 +526,3 @@ class BootstrapOverrideServerVariablesTestCase extends DrupalUnitTestCase {
     }
   }
 }
-
