Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: chrome/test/chromedriver/chrome_launcher.cc

Issue 2230053002: [chromedriver] Added option to make element references W3C compliant. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed presubmit errors. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 return Status(kOk); 311 return Status(kOk);
312 } 312 }
313 313
314 Status LaunchDesktopChrome( 314 Status LaunchDesktopChrome(
315 URLRequestContextGetter* context_getter, 315 URLRequestContextGetter* context_getter,
316 uint16_t port, 316 uint16_t port,
317 std::unique_ptr<PortReservation> port_reservation, 317 std::unique_ptr<PortReservation> port_reservation,
318 const SyncWebSocketFactory& socket_factory, 318 const SyncWebSocketFactory& socket_factory,
319 const Capabilities& capabilities, 319 const Capabilities& capabilities,
320 ScopedVector<DevToolsEventListener>* devtools_event_listeners, 320 ScopedVector<DevToolsEventListener>* devtools_event_listeners,
321 std::unique_ptr<Chrome>* chrome) { 321 std::unique_ptr<Chrome>* chrome,
322 bool w3c_compliant) {
322 base::CommandLine command(base::CommandLine::NO_PROGRAM); 323 base::CommandLine command(base::CommandLine::NO_PROGRAM);
323 base::ScopedTempDir user_data_dir; 324 base::ScopedTempDir user_data_dir;
324 base::ScopedTempDir extension_dir; 325 base::ScopedTempDir extension_dir;
325 std::vector<std::string> extension_bg_pages; 326 std::vector<std::string> extension_bg_pages;
326 Status status = PrepareCommandLine(port, 327 Status status = PrepareCommandLine(port,
327 capabilities, 328 capabilities,
328 &command, 329 &command,
329 &user_data_dir, 330 &user_data_dir,
330 &extension_dir, 331 &extension_dir,
331 &extension_bg_pages); 332 &extension_bg_pages);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 444
444 std::unique_ptr<ChromeDesktopImpl> chrome_desktop(new ChromeDesktopImpl( 445 std::unique_ptr<ChromeDesktopImpl> chrome_desktop(new ChromeDesktopImpl(
445 std::move(devtools_http_client), std::move(devtools_websocket_client), 446 std::move(devtools_http_client), std::move(devtools_websocket_client),
446 *devtools_event_listeners, std::move(port_reservation), 447 *devtools_event_listeners, std::move(port_reservation),
447 std::move(process), command, &user_data_dir, &extension_dir, 448 std::move(process), command, &user_data_dir, &extension_dir,
448 capabilities.network_emulation_enabled)); 449 capabilities.network_emulation_enabled));
449 for (size_t i = 0; i < extension_bg_pages.size(); ++i) { 450 for (size_t i = 0; i < extension_bg_pages.size(); ++i) {
450 VLOG(0) << "Waiting for extension bg page load: " << extension_bg_pages[i]; 451 VLOG(0) << "Waiting for extension bg page load: " << extension_bg_pages[i];
451 std::unique_ptr<WebView> web_view; 452 std::unique_ptr<WebView> web_view;
452 Status status = chrome_desktop->WaitForPageToLoad( 453 Status status = chrome_desktop->WaitForPageToLoad(
453 extension_bg_pages[i], base::TimeDelta::FromSeconds(10), &web_view); 454 extension_bg_pages[i], base::TimeDelta::FromSeconds(10),
455 &web_view, w3c_compliant);
454 if (status.IsError()) { 456 if (status.IsError()) {
455 return Status(kUnknownError, 457 return Status(kUnknownError,
456 "failed to wait for extension background page to load: " + 458 "failed to wait for extension background page to load: " +
457 extension_bg_pages[i], 459 extension_bg_pages[i],
458 status); 460 status);
459 } 461 }
460 } 462 }
461 *chrome = std::move(chrome_desktop); 463 *chrome = std::move(chrome_desktop);
462 return Status(kOk); 464 return Status(kOk);
463 } 465 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 } // namespace 532 } // namespace
531 533
532 Status LaunchChrome( 534 Status LaunchChrome(
533 URLRequestContextGetter* context_getter, 535 URLRequestContextGetter* context_getter,
534 const SyncWebSocketFactory& socket_factory, 536 const SyncWebSocketFactory& socket_factory,
535 DeviceManager* device_manager, 537 DeviceManager* device_manager,
536 PortServer* port_server, 538 PortServer* port_server,
537 PortManager* port_manager, 539 PortManager* port_manager,
538 const Capabilities& capabilities, 540 const Capabilities& capabilities,
539 ScopedVector<DevToolsEventListener>* devtools_event_listeners, 541 ScopedVector<DevToolsEventListener>* devtools_event_listeners,
540 std::unique_ptr<Chrome>* chrome) { 542 std::unique_ptr<Chrome>* chrome,
543 bool w3c_compliant) {
541 if (capabilities.IsRemoteBrowser()) { 544 if (capabilities.IsRemoteBrowser()) {
542 return LaunchRemoteChromeSession( 545 return LaunchRemoteChromeSession(
543 context_getter, socket_factory, 546 context_getter, socket_factory,
544 capabilities, devtools_event_listeners, chrome); 547 capabilities, devtools_event_listeners, chrome);
545 } 548 }
546 549
547 uint16_t port = 0; 550 uint16_t port = 0;
548 std::unique_ptr<PortReservation> port_reservation; 551 std::unique_ptr<PortReservation> port_reservation;
549 Status port_status(kOk); 552 Status port_status(kOk);
550 553
(...skipping 11 matching lines...) Expand all
562 } else { 565 } else {
563 if (port_server) 566 if (port_server)
564 port_status = port_server->ReservePort(&port, &port_reservation); 567 port_status = port_server->ReservePort(&port, &port_reservation);
565 else 568 else
566 port_status = port_manager->ReservePort(&port, &port_reservation); 569 port_status = port_manager->ReservePort(&port, &port_reservation);
567 if (port_status.IsError()) 570 if (port_status.IsError())
568 return Status(kUnknownError, "cannot reserve port for Chrome", 571 return Status(kUnknownError, "cannot reserve port for Chrome",
569 port_status); 572 port_status);
570 return LaunchDesktopChrome(context_getter, port, 573 return LaunchDesktopChrome(context_getter, port,
571 std::move(port_reservation), socket_factory, 574 std::move(port_reservation), socket_factory,
572 capabilities, devtools_event_listeners, chrome); 575 capabilities, devtools_event_listeners, chrome,
576 w3c_compliant);
573 } 577 }
574 } 578 }
575 579
576 namespace internal { 580 namespace internal {
577 581
578 void ConvertHexadecimalToIDAlphabet(std::string* id) { 582 void ConvertHexadecimalToIDAlphabet(std::string* id) {
579 for (size_t i = 0; i < id->size(); ++i) { 583 for (size_t i = 0; i < id->size(); ++i) {
580 int val; 584 int val;
581 if (base::HexStringToInt(base::StringPiece(id->begin() + i, 585 if (base::HexStringToInt(base::StringPiece(id->begin() + i,
582 id->begin() + i + 1), 586 id->begin() + i + 1),
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 // Write empty "First Run" file, otherwise Chrome will wipe the default 872 // Write empty "First Run" file, otherwise Chrome will wipe the default
869 // profile that was written. 873 // profile that was written.
870 if (base::WriteFile( 874 if (base::WriteFile(
871 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { 875 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) {
872 return Status(kUnknownError, "failed to write first run file"); 876 return Status(kUnknownError, "failed to write first run file");
873 } 877 }
874 return Status(kOk); 878 return Status(kOk);
875 } 879 }
876 880
877 } // namespace internal 881 } // namespace internal
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/chrome_launcher.h ('k') | chrome/test/chromedriver/client/chromedriver.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698