| 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_desktop_impl.h" | 5 #include "chrome/test/chromedriver/chrome/chrome_desktop_impl.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
| 10 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 if (id.empty()) | 60 if (id.empty()) |
| 61 return Status(kUnknownError, "automation extension cannot be found"); | 61 return Status(kUnknownError, "automation extension cannot be found"); |
| 62 | 62 |
| 63 scoped_ptr<WebView> web_view(new WebViewImpl( | 63 scoped_ptr<WebView> web_view(new WebViewImpl( |
| 64 id, devtools_http_client_->CreateClient(id))); | 64 id, devtools_http_client_->CreateClient(id))); |
| 65 Status status = web_view->ConnectIfNecessary(); | 65 Status status = web_view->ConnectIfNecessary(); |
| 66 if (status.IsError()) | 66 if (status.IsError()) |
| 67 return status; | 67 return status; |
| 68 | 68 |
| 69 // Wait for the extension background page to load. | 69 // Wait for the extension background page to load. |
| 70 status = web_view->WaitForPendingNavigations(""); | 70 status = web_view->WaitForPendingNavigations(std::string()); |
| 71 if (status.IsError()) | 71 if (status.IsError()) |
| 72 return status; | 72 return status; |
| 73 | 73 |
| 74 automation_extension_.reset(new AutomationExtension(web_view.Pass())); | 74 automation_extension_.reset(new AutomationExtension(web_view.Pass())); |
| 75 } | 75 } |
| 76 *extension = automation_extension_.get(); | 76 *extension = automation_extension_.get(); |
| 77 return Status(kOk); | 77 return Status(kOk); |
| 78 } | 78 } |
| 79 | 79 |
| 80 std::string ChromeDesktopImpl::GetOperatingSystemName() { | 80 std::string ChromeDesktopImpl::GetOperatingSystemName() { |
| 81 return base::SysInfo::OperatingSystemName(); | 81 return base::SysInfo::OperatingSystemName(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 Status ChromeDesktopImpl::Quit() { | 84 Status ChromeDesktopImpl::Quit() { |
| 85 if (!base::KillProcess(process_, 0, true)) { | 85 if (!base::KillProcess(process_, 0, true)) { |
| 86 int exit_code; | 86 int exit_code; |
| 87 if (base::GetTerminationStatus(process_, &exit_code) == | 87 if (base::GetTerminationStatus(process_, &exit_code) == |
| 88 base::TERMINATION_STATUS_STILL_RUNNING) | 88 base::TERMINATION_STATUS_STILL_RUNNING) |
| 89 return Status(kUnknownError, "cannot kill Chrome"); | 89 return Status(kUnknownError, "cannot kill Chrome"); |
| 90 } | 90 } |
| 91 return Status(kOk); | 91 return Status(kOk); |
| 92 } | 92 } |
| OLD | NEW |