summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authorkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-28 08:38:20 +0000
committerkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-28 08:38:20 +0000
commit18c0989ff714302a911975c78494e165fd5a4b7e (patch)
treee7d1c5f0d502b291f44a1aa668318b95d9a56df5 /chrome/test
parentcafe181ce22d75af581b96e590ad2b55fd5640d9 (diff)
downloadchromium_src-18c0989ff714302a911975c78494e165fd5a4b7e.zip
chromium_src-18c0989ff714302a911975c78494e165fd5a4b7e.tar.gz
chromium_src-18c0989ff714302a911975c78494e165fd5a4b7e.tar.bz2
Fix chromedriver logging on windows and logging tests.
BUG=none TEST=none Review URL: http://codereview.chromium.org/9297045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119593 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/webdriver/test/chromedriver_test.py6
-rw-r--r--chrome/test/webdriver/test/chromedriver_tests.py25
-rw-r--r--chrome/test/webdriver/webdriver_logging.cc10
3 files changed, 8 insertions, 33 deletions
diff --git a/chrome/test/webdriver/test/chromedriver_test.py b/chrome/test/webdriver/test/chromedriver_test.py
index b3206bb..e9d51df 100644
--- a/chrome/test/webdriver/test/chromedriver_test.py
+++ b/chrome/test/webdriver/test/chromedriver_test.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -57,6 +57,10 @@ class ChromeDriverTest(unittest.TestCase):
def tearDown(self):
self._factory.QuitAll()
+ def GetServer(self):
+ """Returns the ChromeDriver server being used."""
+ return self._server
+
def GetNewDriver(self, capabilities={}):
"""Returns a new RemoteDriver instance."""
self.assertTrue(self._factory, 'ChromeDriverTest.setUp must be called')
diff --git a/chrome/test/webdriver/test/chromedriver_tests.py b/chrome/test/webdriver/test/chromedriver_tests.py
index 7802589..48b1f27 100644
--- a/chrome/test/webdriver/test/chromedriver_tests.py
+++ b/chrome/test/webdriver/test/chromedriver_tests.py
@@ -777,30 +777,11 @@ class ElementEqualityTest(ChromeDriverTest):
class LoggingTest(ChromeDriverTest):
- def setUp(self):
- self._server2 = ChromeDriverLauncher(self.GetDriverPath()).Launch()
- self._factory2 = ChromeDriverFactory(self._server2)
-
- def tearDown(self):
- self._factory2.QuitAll()
- self._server2.Kill()
-
- def testNoVerboseLogging(self):
- driver = self._factory2.GetNewDriver()
- url = self._factory2.GetServer().GetUrl()
- driver.execute_script('console.log("HI")')
- req = SendRequest(url + '/log', method='GET')
- log = req.read()
- self.assertTrue(':INFO:' not in log, ':INFO: in log: ' + log)
-
- # crbug.com/94470
- def DISABLED_testVerboseLogging(self):
- driver = self._factory2.GetNewDriver({'chrome.verbose': True})
- url = self._factory2.GetServer().GetUrl()
- driver.execute_script('console.log("HI")')
+ def testLogging(self):
+ url = self.GetServer().GetUrl()
req = SendRequest(url + '/log', method='GET')
log = req.read()
- self.assertTrue(':INFO:' in log, ':INFO: not in log: ' + log)
+ self.assertTrue('INFO' in log, msg='INFO not in log: ' + log)
class FileUploadControlTest(ChromeDriverTest):
diff --git a/chrome/test/webdriver/webdriver_logging.cc b/chrome/test/webdriver/webdriver_logging.cc
index fc3e2b2..2819421 100644
--- a/chrome/test/webdriver/webdriver_logging.cc
+++ b/chrome/test/webdriver/webdriver_logging.cc
@@ -128,18 +128,8 @@ void FileLog::Log(LogLevel level, const base::Time& time,
"%s%s\n", padding.c_str(), message.c_str());
base::AutoLock auto_lock(lock_);
-#if defined(OS_WIN)
- SetFilePointer(file_.get(), 0, 0, SEEK_END);
- DWORD num_written;
- WriteFile(file_.get(),
- static_cast<const void*>(entry.c_str()),
- static_cast<DWORD>(entry.length()),
- &num_written,
- NULL);
-#else
fprintf(file_.get(), "%s", entry.c_str());
fflush(file_.get());
-#endif
}
bool FileLog::GetLogContents(std::string* contents) const {