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 // The expectations in this test for the Chrome OS implementation. See | 5 // The expectations in this test for the Chrome OS implementation. See |
6 // networking_private_chromeos_apitest.cc for more info. | 6 // networking_private_chromeos_apitest.cc for more info. |
7 | 7 |
8 var callbackPass = chrome.test.callbackPass; | 8 var callbackPass = chrome.test.callbackPass; |
9 var callbackFail = chrome.test.callbackFail; | 9 var callbackFail = chrome.test.callbackFail; |
10 var assertTrue = chrome.test.assertTrue; | 10 var assertTrue = chrome.test.assertTrue; |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 Security: { | 454 Security: { |
455 Active: 'WPA-PSK', | 455 Active: 'WPA-PSK', |
456 Effective: 'UserPolicy', | 456 Effective: 'UserPolicy', |
457 UserPolicy: 'WPA-PSK' | 457 UserPolicy: 'WPA-PSK' |
458 }, | 458 }, |
459 SignalStrength: 80, | 459 SignalStrength: 80, |
460 } | 460 } |
461 }, result); | 461 }, result); |
462 })); | 462 })); |
463 }, | 463 }, |
| 464 function setCellularProperties() { |
| 465 var network_guid = 'stub_cellular1_guid'; |
| 466 // Make sure we test Cellular.Carrier since it requires a special call |
| 467 // to Shill.Device.SetCarrier. |
| 468 var newCarrier = 'new_carrier'; |
| 469 chrome.networkingPrivate.getProperties( |
| 470 network_guid, |
| 471 callbackPass(function(result) { |
| 472 assertEq(network_guid, result.GUID); |
| 473 assertTrue(!result.Cellular || result.Cellular.Carrier != newCarrier); |
| 474 var new_properties = { |
| 475 Priority: 1, |
| 476 Cellular: { |
| 477 Carrier: newCarrier, |
| 478 }, |
| 479 }; |
| 480 chrome.networkingPrivate.setProperties( |
| 481 network_guid, |
| 482 new_properties, |
| 483 callbackPass(function() { |
| 484 chrome.networkingPrivate.getProperties( |
| 485 network_guid, |
| 486 callbackPass(function(result) { |
| 487 // Ensure that the GUID doesn't change. |
| 488 assertEq(network_guid, result.GUID); |
| 489 // Ensure that the properties were set. |
| 490 assertEq(1, result['Priority']); |
| 491 assertTrue('Cellular' in result); |
| 492 assertEq(newCarrier, result.Cellular.Carrier); |
| 493 })); |
| 494 })); |
| 495 })); |
| 496 }, |
464 function setWiFiProperties() { | 497 function setWiFiProperties() { |
465 var done = chrome.test.callbackAdded(); | |
466 var network_guid = 'stub_wifi1_guid'; | 498 var network_guid = 'stub_wifi1_guid'; |
467 chrome.networkingPrivate.getProperties( | 499 chrome.networkingPrivate.getProperties( |
468 network_guid, | 500 network_guid, |
469 callbackPass(function(result) { | 501 callbackPass(function(result) { |
470 assertEq(network_guid, result.GUID); | 502 assertEq(network_guid, result.GUID); |
471 var new_properties = { | 503 var new_properties = { |
472 Priority: 1, | 504 Priority: 1, |
473 WiFi: { | 505 WiFi: { |
474 AutoConnect: true | 506 AutoConnect: true |
475 }, | 507 }, |
(...skipping 12 matching lines...) Expand all Loading... |
488 // Ensure that the GUID doesn't change. | 520 // Ensure that the GUID doesn't change. |
489 assertEq(network_guid, result.GUID); | 521 assertEq(network_guid, result.GUID); |
490 // Ensure that the properties were set. | 522 // Ensure that the properties were set. |
491 assertEq(1, result['Priority']); | 523 assertEq(1, result['Priority']); |
492 assertTrue('WiFi' in result); | 524 assertTrue('WiFi' in result); |
493 assertTrue('AutoConnect' in result['WiFi']); | 525 assertTrue('AutoConnect' in result['WiFi']); |
494 assertEq(true, result['WiFi']['AutoConnect']); | 526 assertEq(true, result['WiFi']['AutoConnect']); |
495 assertTrue('StaticIPConfig' in result); | 527 assertTrue('StaticIPConfig' in result); |
496 assertEq('1.2.3.4', | 528 assertEq('1.2.3.4', |
497 result['StaticIPConfig']['IPAddress']); | 529 result['StaticIPConfig']['IPAddress']); |
498 done(); | |
499 })); | 530 })); |
500 })); | 531 })); |
501 })); | 532 })); |
502 }, | 533 }, |
503 function setVPNProperties() { | 534 function setVPNProperties() { |
504 var done = chrome.test.callbackAdded(); | |
505 var network_guid = 'stub_vpn1_guid'; | 535 var network_guid = 'stub_vpn1_guid'; |
506 chrome.networkingPrivate.getProperties( | 536 chrome.networkingPrivate.getProperties( |
507 network_guid, | 537 network_guid, |
508 callbackPass(function(result) { | 538 callbackPass(function(result) { |
509 assertEq(network_guid, result.GUID); | 539 assertEq(network_guid, result.GUID); |
510 var new_properties = { | 540 var new_properties = { |
511 Priority: 1, | 541 Priority: 1, |
512 VPN: { | 542 VPN: { |
513 Host: 'vpn.host1' | 543 Host: 'vpn.host1' |
514 } | 544 } |
515 }; | 545 }; |
516 chrome.networkingPrivate.setProperties( | 546 chrome.networkingPrivate.setProperties( |
517 network_guid, | 547 network_guid, |
518 new_properties, | 548 new_properties, |
519 callbackPass(function() { | 549 callbackPass(function() { |
520 chrome.networkingPrivate.getProperties( | 550 chrome.networkingPrivate.getProperties( |
521 network_guid, | 551 network_guid, |
522 callbackPass(function(result) { | 552 callbackPass(function(result) { |
523 // Ensure that the properties were set. | 553 // Ensure that the properties were set. |
524 assertEq(1, result['Priority']); | 554 assertEq(1, result['Priority']); |
525 assertTrue('VPN' in result); | 555 assertTrue('VPN' in result); |
526 assertTrue('Host' in result['VPN']); | 556 assertTrue('Host' in result['VPN']); |
527 assertEq('vpn.host1', result['VPN']['Host']); | 557 assertEq('vpn.host1', result['VPN']['Host']); |
528 // Ensure that the GUID doesn't change. | 558 // Ensure that the GUID doesn't change. |
529 assertEq(network_guid, result.GUID); | 559 assertEq(network_guid, result.GUID); |
530 done(); | |
531 })); | 560 })); |
532 })); | 561 })); |
533 })); | 562 })); |
534 }, | 563 }, |
535 function getState() { | 564 function getState() { |
536 chrome.networkingPrivate.getState( | 565 chrome.networkingPrivate.getState( |
537 'stub_wifi2_guid', | 566 'stub_wifi2_guid', |
538 callbackPass(function(result) { | 567 callbackPass(function(result) { |
539 assertEq({ | 568 assertEq({ |
540 Connectable: true, | 569 Connectable: true, |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 new privateHelpers.watchForCaptivePortalState( | 674 new privateHelpers.watchForCaptivePortalState( |
646 'wifi_guid', 'Online', done); | 675 'wifi_guid', 'Online', done); |
647 chrome.test.sendMessage('notifyPortalDetectorObservers'); | 676 chrome.test.sendMessage('notifyPortalDetectorObservers'); |
648 }, | 677 }, |
649 ]; | 678 ]; |
650 | 679 |
651 var testToRun = window.location.search.substring(1); | 680 var testToRun = window.location.search.substring(1); |
652 chrome.test.runTests(availableTests.filter(function(op) { | 681 chrome.test.runTests(availableTests.filter(function(op) { |
653 return op.name == testToRun; | 682 return op.name == testToRun; |
654 })); | 683 })); |
OLD | NEW |