Index: drupal_web_test_case.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/Attic/drupal_web_test_case.php,v
retrieving revision 1.3.2.4
diff -u -r1.3.2.4 drupal_web_test_case.php
--- drupal_web_test_case.php	9 Nov 2009 20:57:16 -0000	1.3.2.4
+++ drupal_web_test_case.php	11 Nov 2009 06:30:19 -0000
@@ -398,7 +398,8 @@
     $username = variable_get('simpletest_username', NULL);
     $password = variable_get('simpletest_password', NULL);
     if ($username && $password) {
-      $this->httpauth_credentials = $username . ':' . $password;
+      $this->httpauth_username = $username;
+      $this->httpauth_password = $password;
     }
 
     set_error_handler(array($this, 'errorHandler'));
@@ -571,6 +572,14 @@
  * Test case for typical Drupal tests.
  */
 class DrupalWebTestCase extends DrupalTestCase {
+
+  /**
+   * Browser instance.
+   *
+   * @var object
+   */
+  protected $browser;
+
   /**
    * The URL currently loaded in the internal browser.
    *
@@ -662,6 +671,7 @@
    */
   function __construct($test_id = NULL) {
     parent::__construct($test_id);
+
     $this->skipClasses[__CLASS__] = TRUE;
   }
 
@@ -1257,6 +1267,47 @@
   }
 
   /**
+   * Initialize browser.
+   */
+  protected function browserInitialize() {
+    global $db_prefix;
+
+    if (!isset($this->browser)) {
+      module_load_include('inc', 'browser');
+      $this->browser = new Browser();
+      $this->browser->setPageListener(array($this, 'browserPageListener'));
+
+      if (isset($this->httpauth_username)) {
+        $this->browser->setHttpAuthentication($this->httpauth_username, $this->httpauth_password);
+      }
+
+      // By default, the child session name should be the same as the parent.
+      $this->session_name = session_name(); // TODO
+    }
+
+    // Generate a user agent based on the db prefix.
+    if (preg_match('/simpletest\d+/', $db_prefix, $matches)) {
+      $this->browser->setUserAgent(drupal_generate_test_ua($matches[0]));
+    }
+
+    return $this->browser;
+  }
+
+  /**
+   * Browser page callback.
+   */
+  public function browserPageListener(array $state) {
+    $message_vars = array(
+      '!method' => 'FAGGIT' /*$this->browserLastMethod*/,
+      '@url' => $state['url'],
+      '@status' => 1337,
+      '!length' => format_size(strlen($state['content'])),
+    );
+    $message = t('!method @url returned @status (!length).', $message_vars);
+    $this->assertTrue($this->content !== FALSE, $message, t('Browser'));
+  }
+
+  /**
    * Performs a cURL exec with the specified options after calling curlConnect().
    *
    * @param $curl_options
@@ -1383,22 +1434,19 @@
    *   The retrieved HTML string, also available as $this->drupalGetContent()
    */
   protected function drupalGet($path, array $options = array(), array $headers = array()) {
+    // The browser requires the URL to be absolute.
     $options['absolute'] = TRUE;
 
-    // We re-using a CURL connection here. If that connection still has certain
-    // options set, it might change the GET into a POST. Make sure we clear out
-    // previous options.
-    $out = $this->curlExec(array(CURLOPT_HTTPGET => TRUE, CURLOPT_URL => url($path, $options), CURLOPT_NOBODY => FALSE, CURLOPT_HTTPHEADER => $headers));
-    $this->refreshVariables(); // Ensure that any changes to variables in the other thread are picked up.
+    // Make the GET request.
+    $state = $this->browserInitialize()->get(url($path, $options)); // TODO Store state.
+
+    // Ensure that any changes to variables in the other thread are picked up.
+    $this->refreshVariables();
 
-    // Replace original page output with new output from redirected page(s).
-    if (($new = $this->checkForMetaRefresh())) {
-      $out = $new;
-    }
     $this->verbose('GET request to: ' . $path .
-                   '<hr />Ending URL: ' . $this->getUrl() .
-                   '<hr />' . $out);
-    return $out;
+                   '<hr />Ending URL: ' . $state['url'] .
+                   '<hr />' . $state['content']);
+    return $state['content'];
   }
 
   /**
Index: simpletest.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/Attic/simpletest.info,v
retrieving revision 1.8.2.7
diff -u -r1.8.2.7 simpletest.info
--- simpletest.info	10 Nov 2009 03:24:15 -0000	1.8.2.7
+++ simpletest.info	11 Nov 2009 06:30:19 -0000
@@ -9,4 +9,5 @@
 files[] = simpletest.install
 files[] = simpletest.test
 files[] = drupal_web_test_case.php
+dependencies[] = browser
 testing_api = 2.x
