Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: chrome/test/pyautolib/pyautolib.cc

Issue 10383216: Replaced EXPECT_TRUE with a LOG(WARNING) for automation commands to provide more information... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Switched to LOG(WARNING) and report how long the command ran. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/base_paths.h" 5 #include "base/base_paths.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/time.h"
10 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
11 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
12 #include "chrome/test/automation/automation_proxy.h" 13 #include "chrome/test/automation/automation_proxy.h"
13 #include "chrome/test/automation/tab_proxy.h" 14 #include "chrome/test/automation/tab_proxy.h"
14 #include "chrome/test/pyautolib/pyautolib.h" 15 #include "chrome/test/pyautolib/pyautolib.h"
15 #include "googleurl/src/gurl.h" 16 #include "googleurl/src/gurl.h"
16 17
17 static int64 StringToId(const std::wstring& str) { 18 static int64 StringToId(const std::wstring& str) {
18 int64 id; 19 int64 id;
19 base::StringToInt64(WideToUTF8(str), &id); 20 base::StringToInt64(WideToUTF8(str), &id);
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 } 357 }
357 358
358 scoped_refptr<BrowserProxy> PyUITestBase::GetBrowserWindow(int window_index) { 359 scoped_refptr<BrowserProxy> PyUITestBase::GetBrowserWindow(int window_index) {
359 return automation()->GetBrowserWindow(window_index); 360 return automation()->GetBrowserWindow(window_index);
360 } 361 }
361 362
362 std::string PyUITestBase::_SendJSONRequest(int window_index, 363 std::string PyUITestBase::_SendJSONRequest(int window_index,
363 const std::string& request, 364 const std::string& request,
364 int timeout) { 365 int timeout) {
365 std::string response; 366 std::string response;
367 base::TimeTicks time;
366 if (window_index < 0) { // Do not need to target a browser window. 368 if (window_index < 0) { // Do not need to target a browser window.
367 EXPECT_TRUE(automation()->SendJSONRequest(request, timeout, &response)); 369 time = base::TimeTicks::Now();
370 if (!automation()->SendJSONRequest(request, timeout, &response)) {
371 LOG(WARNING) << "SendJSONRequest returned false after "
372 << (base::TimeTicks::Now() - time).InSeconds()
373 << " seconds: " << request;
374 }
368 } else { 375 } else {
369 scoped_refptr<BrowserProxy> browser_proxy = 376 scoped_refptr<BrowserProxy> browser_proxy =
370 automation()->GetBrowserWindow(window_index); 377 automation()->GetBrowserWindow(window_index);
371 EXPECT_TRUE(browser_proxy.get()); 378 EXPECT_TRUE(browser_proxy.get());
372 if (browser_proxy.get()) { 379 if (browser_proxy.get()) {
373 EXPECT_TRUE(browser_proxy->SendJSONRequest(request, timeout, &response)); 380 time = base::TimeTicks::Now();
381 if (!browser_proxy->SendJSONRequest(request, timeout, &response)) {
382 LOG(WARNING) << "SendJSONRequest returned false after "
383 << (base::TimeTicks::Now() - time).InSeconds()
384 << " seconds: " << request;
385 }
374 } 386 }
375 } 387 }
376 return response; 388 return response;
377 } 389 }
378 390
379 bool PyUITestBase::ResetToDefaultTheme() { 391 bool PyUITestBase::ResetToDefaultTheme() {
380 return automation()->ResetToDefaultTheme(); 392 return automation()->ResetToDefaultTheme();
381 } 393 }
382 394
383 bool PyUITestBase::SetCookie(const GURL& cookie_url, 395 bool PyUITestBase::SetCookie(const GURL& cookie_url,
(...skipping 20 matching lines...) Expand all
404 // TODO(phadjan.jr): figure out a way to unambiguously report error. 416 // TODO(phadjan.jr): figure out a way to unambiguously report error.
405 if (!browser_proxy.get()) 417 if (!browser_proxy.get())
406 return cookie_val; 418 return cookie_val;
407 scoped_refptr<TabProxy> tab_proxy = browser_proxy->GetTab(tab_index); 419 scoped_refptr<TabProxy> tab_proxy = browser_proxy->GetTab(tab_index);
408 EXPECT_TRUE(tab_proxy.get()); 420 EXPECT_TRUE(tab_proxy.get());
409 if (!tab_proxy.get()) 421 if (!tab_proxy.get())
410 return cookie_val; 422 return cookie_val;
411 EXPECT_TRUE(tab_proxy->GetCookies(cookie_url, &cookie_val)); 423 EXPECT_TRUE(tab_proxy->GetCookies(cookie_url, &cookie_val));
412 return cookie_val; 424 return cookie_val;
413 } 425 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698