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

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

Issue 1827003004: [Chromedriver] Chromedriver should handle unexpected alert automatically. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: New modifications Created 4 years, 1 month 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 capabilities.debugger_address, capabilities.perf_logging_prefs, 300 capabilities.debugger_address, capabilities.perf_logging_prefs,
301 socket_factory, *devtools_event_listeners, &devtools_websocket_client); 301 socket_factory, *devtools_event_listeners, &devtools_websocket_client);
302 if (status.IsError()) { 302 if (status.IsError()) {
303 LOG(WARNING) << "Browser-wide DevTools client failed to connect: " 303 LOG(WARNING) << "Browser-wide DevTools client failed to connect: "
304 << status.message(); 304 << status.message();
305 } 305 }
306 306
307 chrome->reset(new ChromeRemoteImpl(std::move(devtools_http_client), 307 chrome->reset(new ChromeRemoteImpl(std::move(devtools_http_client),
308 std::move(devtools_websocket_client), 308 std::move(devtools_websocket_client),
309 *devtools_event_listeners, 309 *devtools_event_listeners,
310 capabilities.unexpected_alert_behaviour,
310 capabilities.page_load_strategy)); 311 capabilities.page_load_strategy));
311 return Status(kOk); 312 return Status(kOk);
312 } 313 }
313 314
314 Status LaunchDesktopChrome( 315 Status LaunchDesktopChrome(
315 URLRequestContextGetter* context_getter, 316 URLRequestContextGetter* context_getter,
316 uint16_t port, 317 uint16_t port,
317 std::unique_ptr<PortReservation> port_reservation, 318 std::unique_ptr<PortReservation> port_reservation,
318 const SyncWebSocketFactory& socket_factory, 319 const SyncWebSocketFactory& socket_factory,
319 const Capabilities& capabilities, 320 const Capabilities& capabilities,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 if (status.IsError()) { 440 if (status.IsError()) {
440 LOG(WARNING) << "Browser-wide DevTools client failed to connect: " 441 LOG(WARNING) << "Browser-wide DevTools client failed to connect: "
441 << status.message(); 442 << status.message();
442 } 443 }
443 444
444 std::unique_ptr<ChromeDesktopImpl> chrome_desktop( 445 std::unique_ptr<ChromeDesktopImpl> chrome_desktop(
445 new ChromeDesktopImpl(std::move(devtools_http_client), 446 new ChromeDesktopImpl(std::move(devtools_http_client),
446 std::move(devtools_websocket_client), 447 std::move(devtools_websocket_client),
447 *devtools_event_listeners, 448 *devtools_event_listeners,
448 std::move(port_reservation), 449 std::move(port_reservation),
450 capabilities.unexpected_alert_behaviour,
449 capabilities.page_load_strategy, 451 capabilities.page_load_strategy,
450 std::move(process), 452 std::move(process),
451 command, 453 command,
452 &user_data_dir, 454 &user_data_dir,
453 &extension_dir, 455 &extension_dir,
454 capabilities.network_emulation_enabled)); 456 capabilities.network_emulation_enabled));
455 for (size_t i = 0; i < extension_bg_pages.size(); ++i) { 457 for (size_t i = 0; i < extension_bg_pages.size(); ++i) {
456 VLOG(0) << "Waiting for extension bg page load: " << extension_bg_pages[i]; 458 VLOG(0) << "Waiting for extension bg page load: " << extension_bg_pages[i];
457 std::unique_ptr<WebView> web_view; 459 std::unique_ptr<WebView> web_view;
458 Status status = chrome_desktop->WaitForPageToLoad( 460 Status status = chrome_desktop->WaitForPageToLoad(
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 *devtools_event_listeners, &devtools_websocket_client); 525 *devtools_event_listeners, &devtools_websocket_client);
524 if (status.IsError()) { 526 if (status.IsError()) {
525 LOG(WARNING) << "Browser-wide DevTools client failed to connect: " 527 LOG(WARNING) << "Browser-wide DevTools client failed to connect: "
526 << status.message(); 528 << status.message();
527 } 529 }
528 530
529 chrome->reset(new ChromeAndroidImpl(std::move(devtools_http_client), 531 chrome->reset(new ChromeAndroidImpl(std::move(devtools_http_client),
530 std::move(devtools_websocket_client), 532 std::move(devtools_websocket_client),
531 *devtools_event_listeners, 533 *devtools_event_listeners,
532 std::move(port_reservation), 534 std::move(port_reservation),
535 capabilities.unexpected_alert_behaviour,
533 capabilities.page_load_strategy, 536 capabilities.page_load_strategy,
534 std::move(device))); 537 std::move(device)));
535 return Status(kOk); 538 return Status(kOk);
536 } 539 }
537 540
538 } // namespace 541 } // namespace
539 542
540 Status LaunchChrome( 543 Status LaunchChrome(
541 URLRequestContextGetter* context_getter, 544 URLRequestContextGetter* context_getter,
542 const SyncWebSocketFactory& socket_factory, 545 const SyncWebSocketFactory& socket_factory,
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 // Write empty "First Run" file, otherwise Chrome will wipe the default 879 // Write empty "First Run" file, otherwise Chrome will wipe the default
877 // profile that was written. 880 // profile that was written.
878 if (base::WriteFile( 881 if (base::WriteFile(
879 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { 882 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) {
880 return Status(kUnknownError, "failed to write first run file"); 883 return Status(kUnknownError, "failed to write first run file");
881 } 884 }
882 return Status(kOk); 885 return Status(kOk);
883 } 886 }
884 887
885 } // namespace internal 888 } // namespace internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698