Chromium Code Reviews| 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 417 "Security": { | 417 "Security": { |
| 418 "Active": "WPA-PSK", | 418 "Active": "WPA-PSK", |
| 419 "Effective": "UserPolicy", | 419 "Effective": "UserPolicy", |
| 420 "UserPolicy": "WPA-PSK" | 420 "UserPolicy": "WPA-PSK" |
| 421 }, | 421 }, |
| 422 "SignalStrength": 80, | 422 "SignalStrength": 80, |
| 423 } | 423 } |
| 424 }, result); | 424 }, result); |
| 425 })); | 425 })); |
| 426 }, | 426 }, |
| 427 function setWiFiProperties() { | 427 function setCellularProperties() { |
| 428 var done = chrome.test.callbackAdded(); | 428 var network_guid = 'stub_cellular1_guid'; |
| 429 var network_guid = "stub_wifi1_guid"; | 429 // Make sure we test |
|
pneubeck (no reviews)
2015/03/27 18:26:46
?
stevenjb
2015/03/27 23:18:04
Oops. Fixed.
| |
| 430 var newCarrier = 'new_carrier'; | |
| 430 chrome.networkingPrivate.getProperties( | 431 chrome.networkingPrivate.getProperties( |
| 431 network_guid, | 432 network_guid, |
| 432 callbackPass(function(result) { | 433 callbackPass(function(result) { |
| 434 assertEq(network_guid, result.GUID); | |
| 435 assertFalse(result.Cellular && result.Cellular.Carrier == newCarrier); | |
|
pneubeck (no reviews)
2015/03/27 18:26:46
assertTrue(result.Cellular && result.Cellular.Carr
stevenjb
2015/03/27 23:18:04
We don't actually care if Cellular exists, we just
| |
| 436 var new_properties = { | |
| 437 Priority: 1, | |
| 438 Cellular: { | |
| 439 Carrier: newCarrier, | |
| 440 }, | |
| 441 }; | |
| 442 chrome.networkingPrivate.setProperties( | |
| 443 network_guid, | |
| 444 new_properties, | |
| 445 callbackPass(function() { | |
| 446 chrome.networkingPrivate.getProperties( | |
| 447 network_guid, | |
| 448 callbackPass(function(result) { | |
| 449 // Ensure that the GUID doesn't change. | |
| 450 assertEq(network_guid, result.GUID); | |
| 451 // Ensure that the properties were set. | |
| 452 assertEq(1, result['Priority']); | |
| 453 assertTrue('Cellular' in result); | |
| 454 assertEq(newCarrier, result.Cellular.Carrier); | |
| 455 })); | |
| 456 })); | |
| 457 })); | |
| 458 }, | |
| 459 function setWiFiProperties() { | |
| 460 var network_guid = 'stub_wifi1_guid'; | |
| 461 chrome.networkingPrivate.getProperties( | |
| 462 network_guid, | |
| 463 callbackPass(function(result) { | |
| 433 assertEq(network_guid, result.GUID); | 464 assertEq(network_guid, result.GUID); |
| 434 var new_properties = { | 465 var new_properties = { |
| 435 Priority: 1, | 466 Priority: 1, |
| 436 WiFi: { | 467 WiFi: { |
| 437 AutoConnect: true | 468 AutoConnect: true |
| 438 }, | 469 }, |
| 439 IPAddressConfigType: 'Static', | 470 IPAddressConfigType: 'Static', |
| 440 StaticIPConfig: { | 471 StaticIPConfig: { |
| 441 IPAddress: '1.2.3.4' | 472 IPAddress: '1.2.3.4' |
| 442 } | 473 } |
| 443 }; | 474 }; |
| 444 chrome.networkingPrivate.setProperties( | 475 chrome.networkingPrivate.setProperties( |
| 445 network_guid, | 476 network_guid, |
| 446 new_properties, | 477 new_properties, |
| 447 callbackPass(function() { | 478 callbackPass(function() { |
| 448 chrome.networkingPrivate.getProperties( | 479 chrome.networkingPrivate.getProperties( |
| 449 network_guid, | 480 network_guid, |
| 450 callbackPass(function(result) { | 481 callbackPass(function(result) { |
| 451 // Ensure that the GUID doesn't change. | 482 // Ensure that the GUID doesn't change. |
| 452 assertEq(network_guid, result.GUID); | 483 assertEq(network_guid, result.GUID); |
| 453 // Ensure that the properties were set. | 484 // Ensure that the properties were set. |
| 454 assertEq(1, result['Priority']); | 485 assertEq(1, result['Priority']); |
| 455 assertTrue('WiFi' in result); | 486 assertTrue('WiFi' in result); |
| 456 assertTrue('AutoConnect' in result['WiFi']); | 487 assertTrue('AutoConnect' in result['WiFi']); |
| 457 assertEq(true, result['WiFi']['AutoConnect']); | 488 assertEq(true, result['WiFi']['AutoConnect']); |
| 458 assertTrue('StaticIPConfig' in result); | 489 assertTrue('StaticIPConfig' in result); |
| 459 assertEq('1.2.3.4', | 490 assertEq('1.2.3.4', |
| 460 result['StaticIPConfig']['IPAddress']); | 491 result['StaticIPConfig']['IPAddress']); |
| 461 done(); | |
| 462 })); | 492 })); |
| 463 })); | 493 })); |
| 464 })); | 494 })); |
| 465 }, | 495 }, |
| 466 function setVPNProperties() { | 496 function setVPNProperties() { |
| 467 var done = chrome.test.callbackAdded(); | 497 var network_guid = 'stub_vpn1_guid'; |
| 468 var network_guid = "stub_vpn1_guid"; | |
| 469 chrome.networkingPrivate.getProperties( | 498 chrome.networkingPrivate.getProperties( |
| 470 network_guid, | 499 network_guid, |
| 471 callbackPass(function(result) { | 500 callbackPass(function(result) { |
| 472 assertEq(network_guid, result.GUID); | 501 assertEq(network_guid, result.GUID); |
| 473 var new_properties = { | 502 var new_properties = { |
| 474 Priority: 1, | 503 Priority: 1, |
| 475 VPN: { | 504 VPN: { |
| 476 Host: 'vpn.host1' | 505 Host: 'vpn.host1' |
| 477 } | 506 } |
| 478 }; | 507 }; |
| 479 chrome.networkingPrivate.setProperties( | 508 chrome.networkingPrivate.setProperties( |
| 480 network_guid, | 509 network_guid, |
| 481 new_properties, | 510 new_properties, |
| 482 callbackPass(function() { | 511 callbackPass(function() { |
| 483 chrome.networkingPrivate.getProperties( | 512 chrome.networkingPrivate.getProperties( |
| 484 network_guid, | 513 network_guid, |
| 485 callbackPass(function(result) { | 514 callbackPass(function(result) { |
| 486 // Ensure that the properties were set. | 515 // Ensure that the properties were set. |
| 487 assertEq(1, result['Priority']); | 516 assertEq(1, result['Priority']); |
| 488 assertTrue('VPN' in result); | 517 assertTrue('VPN' in result); |
| 489 assertTrue('Host' in result['VPN']); | 518 assertTrue('Host' in result['VPN']); |
| 490 assertEq('vpn.host1', result['VPN']['Host']); | 519 assertEq('vpn.host1', result['VPN']['Host']); |
| 491 // Ensure that the GUID doesn't change. | 520 // Ensure that the GUID doesn't change. |
| 492 assertEq(network_guid, result.GUID); | 521 assertEq(network_guid, result.GUID); |
| 493 done(); | |
| 494 })); | 522 })); |
| 495 })); | 523 })); |
| 496 })); | 524 })); |
| 497 }, | 525 }, |
| 498 function getState() { | 526 function getState() { |
| 499 chrome.networkingPrivate.getState( | 527 chrome.networkingPrivate.getState( |
| 500 "stub_wifi2_guid", | 528 "stub_wifi2_guid", |
| 501 callbackPass(function(result) { | 529 callbackPass(function(result) { |
| 502 assertEq({ | 530 assertEq({ |
| 503 "Connectable": true, | 531 "Connectable": true, |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 611 new privateHelpers.watchForCaptivePortalState( | 639 new privateHelpers.watchForCaptivePortalState( |
| 612 'wifi_guid', 'Online', done); | 640 'wifi_guid', 'Online', done); |
| 613 chrome.test.sendMessage('notifyPortalDetectorObservers'); | 641 chrome.test.sendMessage('notifyPortalDetectorObservers'); |
| 614 }, | 642 }, |
| 615 ]; | 643 ]; |
| 616 | 644 |
| 617 var testToRun = window.location.search.substring(1); | 645 var testToRun = window.location.search.substring(1); |
| 618 chrome.test.runTests(availableTests.filter(function(op) { | 646 chrome.test.runTests(availableTests.filter(function(op) { |
| 619 return op.name == testToRun; | 647 return op.name == testToRun; |
| 620 })); | 648 })); |
| OLD | NEW |