| 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/posix/eintr_wrapper.h" | 9 #include "base/posix/eintr_wrapper.h" |
| 10 #include "base/process/kill.h" | 10 #include "base/process/kill.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 if (!id.empty()) | 110 if (!id.empty()) |
| 111 break; | 111 break; |
| 112 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); | 112 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); |
| 113 } | 113 } |
| 114 if (id.empty()) | 114 if (id.empty()) |
| 115 return Status(kUnknownError, "page could not be found: " + url); | 115 return Status(kUnknownError, "page could not be found: " + url); |
| 116 | 116 |
| 117 scoped_ptr<WebView> web_view_tmp( | 117 scoped_ptr<WebView> web_view_tmp( |
| 118 new WebViewImpl(id, | 118 new WebViewImpl(id, |
| 119 devtools_http_client_->browser_info(), | 119 devtools_http_client_->browser_info(), |
| 120 devtools_http_client_->CreateClient(id))); | 120 devtools_http_client_->CreateClient(id), |
| 121 devtools_http_client_->device_metrics())); |
| 121 Status status = web_view_tmp->ConnectIfNecessary(); | 122 Status status = web_view_tmp->ConnectIfNecessary(); |
| 122 if (status.IsError()) | 123 if (status.IsError()) |
| 123 return status; | 124 return status; |
| 124 | 125 |
| 125 status = web_view_tmp->WaitForPendingNavigations( | 126 status = web_view_tmp->WaitForPendingNavigations( |
| 126 std::string(), deadline - base::TimeTicks::Now(), false); | 127 std::string(), deadline - base::TimeTicks::Now(), false); |
| 127 if (status.IsOk()) | 128 if (status.IsOk()) |
| 128 *web_view = web_view_tmp.Pass(); | 129 *web_view = web_view_tmp.Pass(); |
| 129 return status; | 130 return status; |
| 130 } | 131 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 148 } | 149 } |
| 149 | 150 |
| 150 ChromeDesktopImpl* ChromeDesktopImpl::GetAsDesktop() { | 151 ChromeDesktopImpl* ChromeDesktopImpl::GetAsDesktop() { |
| 151 return this; | 152 return this; |
| 152 } | 153 } |
| 153 | 154 |
| 154 std::string ChromeDesktopImpl::GetOperatingSystemName() { | 155 std::string ChromeDesktopImpl::GetOperatingSystemName() { |
| 155 return base::SysInfo::OperatingSystemName(); | 156 return base::SysInfo::OperatingSystemName(); |
| 156 } | 157 } |
| 157 | 158 |
| 159 bool ChromeDesktopImpl::IsMobileEmulationEnabled() const { |
| 160 return devtools_http_client_->device_metrics() != NULL; |
| 161 } |
| 162 |
| 158 Status ChromeDesktopImpl::QuitImpl() { | 163 Status ChromeDesktopImpl::QuitImpl() { |
| 159 if (!KillProcess(process_)) | 164 if (!KillProcess(process_)) |
| 160 return Status(kUnknownError, "cannot kill Chrome"); | 165 return Status(kUnknownError, "cannot kill Chrome"); |
| 161 return Status(kOk); | 166 return Status(kOk); |
| 162 } | 167 } |
| 163 | 168 |
| 164 const CommandLine& ChromeDesktopImpl::command() const { | 169 const CommandLine& ChromeDesktopImpl::command() const { |
| 165 return command_; | 170 return command_; |
| 166 } | 171 } |
| OLD | NEW |