]> git.parisson.com Git - pdf.js.git/commitdiff
Suppress messages from the browser
authornotmasteryet <async.processingjs@yahoo.com>
Fri, 9 Dec 2011 02:51:12 +0000 (20:51 -0600)
committernotmasteryet <async.processingjs@yahoo.com>
Fri, 9 Dec 2011 02:51:12 +0000 (20:51 -0600)
test/test.py

index 256200587bcdfb4e5d3606f823c1c6bc332588e9..888bd9ce863240dad429b0c504c9c7a62b82d97c 100644 (file)
@@ -12,6 +12,7 @@ DOC_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__),".."))
 ANAL = True
 DEFAULT_MANIFEST_FILE = 'test_manifest.json'
 EQLOG_FILE = 'eq.log'
+BROWSERLOG_FILE = 'browser.log'
 REFDIR = 'ref'
 TMPDIR = 'tmp'
 VERBOSE = False
@@ -229,6 +230,7 @@ class BaseBrowserCommand(object):
     def setup(self):
         self.tempDir = tempfile.mkdtemp()
         self.profileDir = os.path.join(self.tempDir, "profile")
+        self.browserLog = open(BROWSERLOG_FILE, "w")
 
     def teardown(self):
         # If the browser is still running, wait up to ten seconds for it to quit
@@ -245,6 +247,8 @@ class BaseBrowserCommand(object):
         if self.tempDir is not None and os.path.exists(self.tempDir):
             shutil.rmtree(self.tempDir)
 
+        self.browserLog.close()
+
     def start(self, url):
         raise Exception("Can't start BaseBrowserCommand")
 
@@ -262,7 +266,7 @@ class FirefoxBrowserCommand(BaseBrowserCommand):
         if platform.system() == "Darwin":
             cmds.append("-foreground")
         cmds.extend(["-no-remote", "-profile", self.profileDir, url])
-        self.process = subprocess.Popen(cmds)
+        self.process = subprocess.Popen(cmds, stdout = self.browserLog, stderr = self.browserLog)
 
 class ChromeBrowserCommand(BaseBrowserCommand):
     def _fixupMacPath(self):
@@ -272,7 +276,7 @@ class ChromeBrowserCommand(BaseBrowserCommand):
         cmds = [self.path]
         cmds.extend(["--user-data-dir=%s" % self.profileDir,
                      "--no-first-run", "--disable-sync", url])
-        self.process = subprocess.Popen(cmds)
+        self.process = subprocess.Popen(cmds, stdout = self.browserLog, stderr = self.browserLog)
 
 def makeBrowserCommand(browser):
     path = browser["path"].lower()