diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-20 20:22:07 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-20 20:22:07 +0000 |
commit | ca8cf5f8032626708e47604d190dbda0ffd8d618 (patch) | |
tree | 4a73ad587be839680e0e0b879ef664558bf3a87a /chrome/test/webdriver/session.cc | |
parent | 593df619ff5c865bea2ffdd8927e5462c91318a2 (diff) | |
download | chromium_src-ca8cf5f8032626708e47604d190dbda0ffd8d618.zip chromium_src-ca8cf5f8032626708e47604d190dbda0ffd8d618.tar.gz chromium_src-ca8cf5f8032626708e47604d190dbda0ffd8d618.tar.bz2 |
Convert LOG(INFO) to VLOG(1) - chrome/test/.
Also fix indentation, remove a few unnecessary endls, collapse some append()s into +s, and remove a few extra {}s.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3915004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63253 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/webdriver/session.cc')
-rw-r--r-- | chrome/test/webdriver/session.cc | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/chrome/test/webdriver/session.cc b/chrome/test/webdriver/session.cc index 84d2cbd..218c7f1 100644 --- a/chrome/test/webdriver/session.cc +++ b/chrome/test/webdriver/session.cc @@ -69,8 +69,8 @@ bool Session::Init() { // Create a temp directory for the new profile. if (!CreateTemporaryProfileDirectory()) { LOG(ERROR) << "Could not make a temp profile directory, " - << tmp_profile_dir() << std::endl - << "Need to quit, the issue must be fixed"; + << tmp_profile_dir() + << "\nNeed to quit, the issue must be fixed"; exit(-1); } @@ -163,7 +163,7 @@ bool Session::CreateTemporaryProfileDirectory() { return false; } #endif - LOG(INFO) << "Using temporary profile directory: " << tmp_profile_dir_; + VLOG(1) << "Using temporary profile directory: " << tmp_profile_dir_; return true; } @@ -174,10 +174,8 @@ void Session::Terminate() { #elif OS_WIN FilePath del_dir = FilePath(ASCIIToWide(tmp_profile_dir())); #endif - if (file_util::PathExists(del_dir) && !file_util::Delete(del_dir, true)) { - LOG(ERROR) << "Could not clean up temp directory: " - << tmp_profile_dir() << std::endl; - } + if (file_util::PathExists(del_dir) && !file_util::Delete(del_dir, true)) + LOG(ERROR) << "Could not clean up temp directory: " << tmp_profile_dir(); } ErrorCode Session::ExecuteScript(const std::wstring& script, @@ -188,21 +186,17 @@ ErrorCode Session::ExecuteScript(const std::wstring& script, /*pretty_print=*/false, &args_as_json); - std::wstring jscript = L"window.domAutomationController.send("; - jscript.append(L"(function(){") - // Every injected script is fed through the executeScript atom. This atom - // will catch any errors that are thrown and convert them to the - // appropriate JSON structure. - .append(build_atom(EXECUTE_SCRIPT, sizeof EXECUTE_SCRIPT)) - .append(L"var result = executeScript(function(){") - .append(script) - .append(L"},") - .append(ASCIIToWide(args_as_json)) - .append(L");return JSON.stringify(result);})());"); + std::wstring jscript = L"window.domAutomationController.send((function(){" + + // Every injected script is fed through the executeScript atom. This atom + // will catch any errors that are thrown and convert them to the + // appropriate JSON structure. + build_atom(EXECUTE_SCRIPT, sizeof EXECUTE_SCRIPT) + + L"var result = executeScript(function(){" + script + L"}," + + ASCIIToWide(args_as_json) + L");return JSON.stringify(result);})());"; // Should we also log the script that's being executed? It could be several KB // in size and will add lots of noise to the logs. - LOG(INFO) << "Executing script in frame: " << current_frame_xpath_; + VLOG(1) << "Executing script in frame: " << current_frame_xpath_; std::wstring result; scoped_refptr<TabProxy> tab = ActiveTab(); @@ -212,7 +206,7 @@ ErrorCode Session::ExecuteScript(const std::wstring& script, return kUnknownError; } - LOG(INFO) << "...script result: " << result; + VLOG(1) << "...script result: " << result; std::string temp = WideToASCII(result); scoped_ptr<Value> r(base::JSONReader::ReadAndReturnError( temp, true, NULL, NULL)); @@ -225,9 +219,8 @@ ErrorCode Session::ExecuteScript(const std::wstring& script, if (r->GetType() != Value::TYPE_DICTIONARY) { std::ostringstream stream; stream << "Internal script execution error: script result must be a " - << print_valuetype(Value::TYPE_DICTIONARY) - << ", but was " - << print_valuetype(r->GetType()) << ": " << result; + << print_valuetype(Value::TYPE_DICTIONARY) << ", but was " + << print_valuetype(r->GetType()) << ": " << result; *value = Value::CreateStringValue(stream.str()); return kUnknownError; } |