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_launcher.h" | 5 #include "chrome/test/chromedriver/chrome_launcher.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 "Chrome failed to start: " + termination_reason); | 306 "Chrome failed to start: " + termination_reason); |
307 } | 307 } |
308 if (!base::KillProcess(process, 0, true)) { | 308 if (!base::KillProcess(process, 0, true)) { |
309 int exit_code; | 309 int exit_code; |
310 if (base::GetTerminationStatus(process, &exit_code) == | 310 if (base::GetTerminationStatus(process, &exit_code) == |
311 base::TERMINATION_STATUS_STILL_RUNNING) | 311 base::TERMINATION_STATUS_STILL_RUNNING) |
312 return Status(kUnknownError, "cannot kill Chrome", status); | 312 return Status(kUnknownError, "cannot kill Chrome", status); |
313 } | 313 } |
314 return status; | 314 return status; |
315 } | 315 } |
| 316 scoped_ptr<DeviceMetrics> device_metrics( |
| 317 new DeviceMetrics(capabilities.device_metrics)); |
316 scoped_ptr<ChromeDesktopImpl> chrome_desktop( | 318 scoped_ptr<ChromeDesktopImpl> chrome_desktop( |
317 new ChromeDesktopImpl(devtools_client.Pass(), | 319 new ChromeDesktopImpl(devtools_client.Pass(), |
318 devtools_event_listeners, | 320 devtools_event_listeners, |
319 port_reservation.Pass(), | 321 port_reservation.Pass(), |
320 process, | 322 process, |
321 command, | 323 command, |
| 324 device_metrics.Pass(), |
322 &user_data_dir, | 325 &user_data_dir, |
323 &extension_dir)); | 326 &extension_dir)); |
324 for (size_t i = 0; i < extension_bg_pages.size(); ++i) { | 327 for (size_t i = 0; i < extension_bg_pages.size(); ++i) { |
325 VLOG(0) << "Waiting for extension bg page load: " << extension_bg_pages[i]; | 328 VLOG(0) << "Waiting for extension bg page load: " << extension_bg_pages[i]; |
326 scoped_ptr<WebView> web_view; | 329 scoped_ptr<WebView> web_view; |
327 Status status = chrome_desktop->WaitForPageToLoad( | 330 Status status = chrome_desktop->WaitForPageToLoad( |
328 extension_bg_pages[i], base::TimeDelta::FromSeconds(10), &web_view); | 331 extension_bg_pages[i], base::TimeDelta::FromSeconds(10), &web_view); |
329 if (status.IsError()) { | 332 if (status.IsError()) { |
330 return Status(kUnknownError, | 333 return Status(kUnknownError, |
331 "failed to wait for extension background page to load: " + | 334 "failed to wait for extension background page to load: " + |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 // Write empty "First Run" file, otherwise Chrome will wipe the default | 688 // Write empty "First Run" file, otherwise Chrome will wipe the default |
686 // profile that was written. | 689 // profile that was written. |
687 if (base::WriteFile( | 690 if (base::WriteFile( |
688 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { | 691 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { |
689 return Status(kUnknownError, "failed to write first run file"); | 692 return Status(kUnknownError, "failed to write first run file"); |
690 } | 693 } |
691 return Status(kOk); | 694 return Status(kOk); |
692 } | 695 } |
693 | 696 |
694 } // namespace internal | 697 } // namespace internal |
OLD | NEW |