OLD | NEW |
---|---|
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/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
356 } | 356 } |
357 | 357 |
358 scoped_refptr<BrowserProxy> PyUITestBase::GetBrowserWindow(int window_index) { | 358 scoped_refptr<BrowserProxy> PyUITestBase::GetBrowserWindow(int window_index) { |
359 return automation()->GetBrowserWindow(window_index); | 359 return automation()->GetBrowserWindow(window_index); |
360 } | 360 } |
361 | 361 |
362 std::string PyUITestBase::_SendJSONRequest(int window_index, | 362 std::string PyUITestBase::_SendJSONRequest(int window_index, |
363 const std::string& request, | 363 const std::string& request, |
364 int timeout) { | 364 int timeout) { |
365 std::string response; | 365 std::string response; |
366 bool response_status; | |
366 if (window_index < 0) { // Do not need to target a browser window. | 367 if (window_index < 0) { // Do not need to target a browser window. |
367 EXPECT_TRUE(automation()->SendJSONRequest(request, timeout, &response)); | 368 response_status = automation()->SendJSONRequest(request, timeout, |
369 &response); | |
368 } else { | 370 } else { |
369 scoped_refptr<BrowserProxy> browser_proxy = | 371 scoped_refptr<BrowserProxy> browser_proxy = |
370 automation()->GetBrowserWindow(window_index); | 372 automation()->GetBrowserWindow(window_index); |
371 EXPECT_TRUE(browser_proxy.get()); | 373 EXPECT_TRUE(browser_proxy.get()); |
372 if (browser_proxy.get()) { | 374 if (browser_proxy.get()) { |
373 EXPECT_TRUE(browser_proxy->SendJSONRequest(request, timeout, &response)); | 375 response_status = browser_proxy->SendJSONRequest(request, timeout, |
376 &response); | |
374 } | 377 } |
375 } | 378 } |
379 if (!response_status) { | |
380 LOG(FATAL) << "Automation failed: " << request; | |
Nirnimesh
2012/05/16 19:55:17
No, do not make it fatal. There are tests to verif
| |
381 } | |
376 return response; | 382 return response; |
377 } | 383 } |
378 | 384 |
379 bool PyUITestBase::ResetToDefaultTheme() { | 385 bool PyUITestBase::ResetToDefaultTheme() { |
380 return automation()->ResetToDefaultTheme(); | 386 return automation()->ResetToDefaultTheme(); |
381 } | 387 } |
382 | 388 |
383 bool PyUITestBase::SetCookie(const GURL& cookie_url, | 389 bool PyUITestBase::SetCookie(const GURL& cookie_url, |
384 const std::string& value, | 390 const std::string& value, |
385 int window_index, | 391 int window_index, |
(...skipping 18 matching lines...) Expand all Loading... | |
404 // TODO(phadjan.jr): figure out a way to unambiguously report error. | 410 // TODO(phadjan.jr): figure out a way to unambiguously report error. |
405 if (!browser_proxy.get()) | 411 if (!browser_proxy.get()) |
406 return cookie_val; | 412 return cookie_val; |
407 scoped_refptr<TabProxy> tab_proxy = browser_proxy->GetTab(tab_index); | 413 scoped_refptr<TabProxy> tab_proxy = browser_proxy->GetTab(tab_index); |
408 EXPECT_TRUE(tab_proxy.get()); | 414 EXPECT_TRUE(tab_proxy.get()); |
409 if (!tab_proxy.get()) | 415 if (!tab_proxy.get()) |
410 return cookie_val; | 416 return cookie_val; |
411 EXPECT_TRUE(tab_proxy->GetCookies(cookie_url, &cookie_val)); | 417 EXPECT_TRUE(tab_proxy->GetCookies(cookie_url, &cookie_val)); |
412 return cookie_val; | 418 return cookie_val; |
413 } | 419 } |
OLD | NEW |