OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/string_number_conversions.h" | 6 #include "base/string_number_conversions.h" |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/test/automation/extension_proxy.h" | 9 #include "chrome/test/automation/extension_proxy.h" |
10 #include "chrome/test/automation/tab_proxy.h" | 10 #include "chrome/test/automation/tab_proxy.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 return false; | 316 return false; |
317 | 317 |
318 return browser_proxy->RemoveBookmark(StringToId(id)); | 318 return browser_proxy->RemoveBookmark(StringToId(id)); |
319 } | 319 } |
320 | 320 |
321 scoped_refptr<BrowserProxy> PyUITestBase::GetBrowserWindow(int window_index) { | 321 scoped_refptr<BrowserProxy> PyUITestBase::GetBrowserWindow(int window_index) { |
322 return automation()->GetBrowserWindow(window_index); | 322 return automation()->GetBrowserWindow(window_index); |
323 } | 323 } |
324 | 324 |
325 std::string PyUITestBase::_SendJSONRequest(int window_index, | 325 std::string PyUITestBase::_SendJSONRequest(int window_index, |
326 const std::string& request) { | 326 const std::string& request, |
| 327 int timeout) { |
327 std::string response; | 328 std::string response; |
328 if (window_index < 0) { // Do not need to target a browser window. | 329 if (window_index < 0) { // Do not need to target a browser window. |
329 EXPECT_TRUE(automation()->SendJSONRequest(request, &response)); | 330 EXPECT_TRUE(automation()->SendJSONRequest(request, timeout, &response)); |
330 } else { | 331 } else { |
331 scoped_refptr<BrowserProxy> browser_proxy = | 332 scoped_refptr<BrowserProxy> browser_proxy = |
332 automation()->GetBrowserWindow(window_index); | 333 automation()->GetBrowserWindow(window_index); |
333 EXPECT_TRUE(browser_proxy.get()); | 334 EXPECT_TRUE(browser_proxy.get()); |
334 if (browser_proxy.get()) { | 335 if (browser_proxy.get()) { |
335 EXPECT_TRUE(browser_proxy->SendJSONRequest(request, &response)); | 336 EXPECT_TRUE(browser_proxy->SendJSONRequest(request, timeout, &response)); |
336 } | 337 } |
337 } | 338 } |
338 return response; | 339 return response; |
339 } | 340 } |
340 | 341 |
341 std::wstring PyUITestBase::ExecuteJavascript(const std::wstring& script, | 342 std::wstring PyUITestBase::ExecuteJavascript(const std::wstring& script, |
342 int window_index, | 343 int window_index, |
343 int tab_index, | 344 int tab_index, |
344 const std::wstring& frame_xpath) { | 345 const std::wstring& frame_xpath) { |
345 scoped_refptr<BrowserProxy> browser_proxy = | 346 scoped_refptr<BrowserProxy> browser_proxy = |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 // TODO(phadjan.jr): figure out a way to unambiguously report error. | 397 // TODO(phadjan.jr): figure out a way to unambiguously report error. |
397 if (!browser_proxy.get()) | 398 if (!browser_proxy.get()) |
398 return cookie_val; | 399 return cookie_val; |
399 scoped_refptr<TabProxy> tab_proxy = browser_proxy->GetTab(tab_index); | 400 scoped_refptr<TabProxy> tab_proxy = browser_proxy->GetTab(tab_index); |
400 EXPECT_TRUE(tab_proxy.get()); | 401 EXPECT_TRUE(tab_proxy.get()); |
401 if (!tab_proxy.get()) | 402 if (!tab_proxy.get()) |
402 return cookie_val; | 403 return cookie_val; |
403 EXPECT_TRUE(tab_proxy->GetCookies(cookie_url, &cookie_val)); | 404 EXPECT_TRUE(tab_proxy->GetCookies(cookie_url, &cookie_val)); |
404 return cookie_val; | 405 return cookie_val; |
405 } | 406 } |
OLD | NEW |