| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/chromedriver/chrome/chrome_android_impl.h" | 5 #include "chrome/test/chromedriver/chrome/chrome_android_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| 11 #include "chrome/test/chromedriver/chrome/status.h" | 11 #include "chrome/test/chromedriver/chrome/status.h" |
| 12 #include "chrome/test/chromedriver/chrome/web_view.h" | |
| 13 #include "chrome/test/chromedriver/net/sync_websocket_impl.h" | 12 #include "chrome/test/chromedriver/net/sync_websocket_impl.h" |
| 14 #include "chrome/test/chromedriver/net/url_request_context_getter.h" | 13 #include "chrome/test/chromedriver/net/url_request_context_getter.h" |
| 15 | 14 |
| 16 ChromeAndroidImpl::ChromeAndroidImpl( | 15 ChromeAndroidImpl::ChromeAndroidImpl( |
| 17 URLRequestContextGetter* context_getter, | 16 URLRequestContextGetter* context_getter, |
| 18 int port, | 17 int port, |
| 19 const SyncWebSocketFactory& socket_factory) | 18 const SyncWebSocketFactory& socket_factory) |
| 20 : ChromeImpl(context_getter, port, socket_factory) {} | 19 : ChromeImpl(context_getter, port, socket_factory) {} |
| 21 | 20 |
| 22 ChromeAndroidImpl::~ChromeAndroidImpl() {} | 21 ChromeAndroidImpl::~ChromeAndroidImpl() {} |
| (...skipping 15 matching lines...) Expand all Loading... |
| 38 "failed to run adb_commands.py. Make sure it is set in PATH."); | 37 "failed to run adb_commands.py. Make sure it is set in PATH."); |
| 39 else | 38 else |
| 40 return Status(kUnknownError, "android app failed to start.\n" + output); | 39 return Status(kUnknownError, "android app failed to start.\n" + output); |
| 41 } | 40 } |
| 42 | 41 |
| 43 Status status = Init(); | 42 Status status = Init(); |
| 44 if (status.IsError()) { | 43 if (status.IsError()) { |
| 45 Quit(); | 44 Quit(); |
| 46 return status; | 45 return status; |
| 47 } | 46 } |
| 48 std::list<WebView*> web_views; | |
| 49 status = GetWebViews(&web_views); | |
| 50 if (status.IsError() || web_views.empty()) { | |
| 51 Quit(); | |
| 52 return status.IsError() ? status : | |
| 53 Status(kUnknownError, "unable to discover open window in chrome"); | |
| 54 } | |
| 55 | 47 |
| 56 return Status(kOk); | 48 return Status(kOk); |
| 57 } | 49 } |
| 58 | 50 |
| 59 std::string ChromeAndroidImpl::GetOperatingSystemName() { | 51 std::string ChromeAndroidImpl::GetOperatingSystemName() { |
| 60 return "ANDROID"; | 52 return "ANDROID"; |
| 61 } | 53 } |
| 62 | 54 |
| 63 Status ChromeAndroidImpl::Quit() { | 55 Status ChromeAndroidImpl::Quit() { |
| 64 // NOOP. | 56 // NOOP. |
| 65 return Status(kOk); | 57 return Status(kOk); |
| 66 } | 58 } |
| 67 | 59 |
| OLD | NEW |