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 "chrome/test/automation/browser_proxy.h" | 5 #include "chrome/test/automation/browser_proxy.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 bool succeeded = false; | 44 bool succeeded = false; |
45 | 45 |
46 if (!sender_->Send(new AutomationMsg_BringBrowserToFront( | 46 if (!sender_->Send(new AutomationMsg_BringBrowserToFront( |
47 handle_, &succeeded))) { | 47 handle_, &succeeded))) { |
48 return false; | 48 return false; |
49 } | 49 } |
50 | 50 |
51 return succeeded; | 51 return succeeded; |
52 } | 52 } |
53 | 53 |
54 bool BrowserProxy::IsMenuCommandEnabled(int id, bool* enabled) { | |
55 if (!is_valid()) | |
56 return false; | |
57 | |
58 return sender_->Send(new AutomationMsg_IsMenuCommandEnabled(handle_, id, | |
59 enabled)); | |
60 } | |
61 | |
62 bool BrowserProxy::AppendTab(const GURL& tab_url) { | 54 bool BrowserProxy::AppendTab(const GURL& tab_url) { |
63 if (!is_valid()) | 55 if (!is_valid()) |
64 return false; | 56 return false; |
65 | 57 |
66 int append_tab_response = -1; | 58 int append_tab_response = -1; |
67 | 59 |
68 sender_->Send(new AutomationMsg_AppendTab(handle_, tab_url, | 60 sender_->Send(new AutomationMsg_AppendTab(handle_, tab_url, |
69 &append_tab_response)); | 61 &append_tab_response)); |
70 return append_tab_response >= 0; | 62 return append_tab_response >= 0; |
71 } | 63 } |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 bool BrowserProxy::RemoveBookmark(int64 id) { | 348 bool BrowserProxy::RemoveBookmark(int64 id) { |
357 if (!is_valid()) | 349 if (!is_valid()) |
358 return false; | 350 return false; |
359 bool result = false; | 351 bool result = false; |
360 sender_->Send(new AutomationMsg_RemoveBookmark(handle_, | 352 sender_->Send(new AutomationMsg_RemoveBookmark(handle_, |
361 id, | 353 id, |
362 &result)); | 354 &result)); |
363 return result; | 355 return result; |
364 } | 356 } |
365 | 357 |
366 bool BrowserProxy::IsShelfVisible(bool* is_visible) { | |
367 if (!is_valid()) | |
368 return false; | |
369 | |
370 if (!is_visible) { | |
371 NOTREACHED(); | |
372 return false; | |
373 } | |
374 | |
375 return sender_->Send(new AutomationMsg_ShelfVisibility(handle_, | |
376 is_visible)); | |
377 } | |
378 | |
379 bool BrowserProxy::SetShelfVisible(bool is_visible) { | |
380 if (!is_valid()) | |
381 return false; | |
382 | |
383 return sender_->Send(new AutomationMsg_SetShelfVisibility(handle_, | |
384 is_visible)); | |
385 } | |
386 | |
387 bool BrowserProxy::TerminateSession() { | 358 bool BrowserProxy::TerminateSession() { |
388 if (!is_valid()) | 359 if (!is_valid()) |
389 return false; | 360 return false; |
390 | 361 |
391 bool result = false; | 362 bool result = false; |
392 | 363 |
393 sender_->Send(new AutomationMsg_TerminateSession(handle_, &result)); | 364 sender_->Send(new AutomationMsg_TerminateSession(handle_, &result)); |
394 | 365 |
395 return result; | 366 return result; |
396 } | 367 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 if (i == 0) | 461 if (i == 0) |
491 *min_start_time = start_ms; | 462 *min_start_time = start_ms; |
492 | 463 |
493 *min_start_time = std::min(start_ms, *min_start_time); | 464 *min_start_time = std::min(start_ms, *min_start_time); |
494 *max_stop_time = std::max(stop_ms, *max_stop_time); | 465 *max_stop_time = std::max(stop_ms, *max_stop_time); |
495 stop_times->push_back(stop_ms); | 466 stop_times->push_back(stop_ms); |
496 } | 467 } |
497 std::sort(stop_times->begin(), stop_times->end()); | 468 std::sort(stop_times->begin(), stop_times->end()); |
498 return true; | 469 return true; |
499 } | 470 } |
OLD | NEW |