Commit 3bd85867 authored by craigdh@chromium.org's avatar craigdh@chromium.org

Replaced EXPECT_TRUE with a LOG(WARNING) for automation commands to provide...

Replaced EXPECT_TRUE with a LOG(WARNING) for automation commands to provide more information about the failure.

Also reports the amount of time the automation call took, which should give some idea whether it returned due to a timeout.

BUG=chromium-os:30880
TEST=Compiled and ran a PyAuto test.

Review URL: https://chromiumcodereview.appspot.com/10383216

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137570 0039d316-1c4b-4281-b951-d872f2087c98
parent 2737aa0f
......@@ -7,6 +7,7 @@
#include "base/path_service.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/automation/automation_proxy.h"
......@@ -363,14 +364,25 @@ std::string PyUITestBase::_SendJSONRequest(int window_index,
const std::string& request,
int timeout) {
std::string response;
base::TimeTicks time;
if (window_index < 0) { // Do not need to target a browser window.
EXPECT_TRUE(automation()->SendJSONRequest(request, timeout, &response));
time = base::TimeTicks::Now();
if (!automation()->SendJSONRequest(request, timeout, &response)) {
LOG(WARNING) << "SendJSONRequest returned false after "
<< (base::TimeTicks::Now() - time).InSeconds()
<< " seconds: " << request;
}
} else {
scoped_refptr<BrowserProxy> browser_proxy =
automation()->GetBrowserWindow(window_index);
EXPECT_TRUE(browser_proxy.get());
if (browser_proxy.get()) {
EXPECT_TRUE(browser_proxy->SendJSONRequest(request, timeout, &response));
time = base::TimeTicks::Now();
if (!browser_proxy->SendJSONRequest(request, timeout, &response)) {
LOG(WARNING) << "SendJSONRequest returned false after "
<< (base::TimeTicks::Now() - time).InSeconds()
<< " seconds: " << request;
}
}
}
return response;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment