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

Side by Side Diff: chrome/test/data/extensions/api_test/networking/test.js

Issue 694533007: Add 'setProperties' to InternetOptionsHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + feedback Created 6 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 // Note: the expectations in this test are shared by both the Chrome OS and 5 // Note: the expectations in this test are shared by both the Chrome OS and
6 // Win/Mac (ServiceClient) implementations. TODO(stevenjb): Set up a way for 6 // Win/Mac (ServiceClient) implementations. TODO(stevenjb): Set up a way for
7 // the test code to specify the correct expectations. 7 // the test code to specify the correct expectations.
8 8
9 var callbackPass = chrome.test.callbackPass; 9 var callbackPass = chrome.test.callbackPass;
10 var callbackFail = chrome.test.callbackFail; 10 var callbackFail = chrome.test.callbackFail;
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 "Security": { 366 "Security": {
367 "Active": "WPA-PSK", 367 "Active": "WPA-PSK",
368 "Effective": "UserPolicy", 368 "Effective": "UserPolicy",
369 "UserPolicy": "WPA-PSK" 369 "UserPolicy": "WPA-PSK"
370 }, 370 },
371 "SignalStrength": 80, 371 "SignalStrength": 80,
372 } 372 }
373 }, result); 373 }, result);
374 })); 374 }));
375 }, 375 },
376 function setProperties() { 376 function setWiFiProperties() {
377 var done = chrome.test.callbackAdded(); 377 var done = chrome.test.callbackAdded();
378 var network_guid = "stub_wifi2_guid"; 378 var network_guid = "stub_wifi1_guid";
379 chrome.networkingPrivate.getProperties( 379 chrome.networkingPrivate.getProperties(
380 network_guid, 380 network_guid,
381 callbackPass(function(result) { 381 callbackPass(function(result) {
382 assertEq(network_guid, result.GUID); 382 assertEq(network_guid, result.GUID);
383 result.WiFi.Security = "WEP-PSK"; 383 var new_properties = {
384 Priority: 1,
385 WiFi: {
386 AutoConnect: true
387 }
388 };
384 chrome.networkingPrivate.setProperties( 389 chrome.networkingPrivate.setProperties(
385 network_guid, 390 network_guid,
386 result, 391 new_properties,
387 callbackPass(function() { 392 callbackPass(function() {
388 chrome.networkingPrivate.getProperties( 393 chrome.networkingPrivate.getProperties(
389 network_guid, 394 network_guid,
390 callbackPass(function(result) { 395 callbackPass(function(result) {
391 // Ensure that the property was set. 396 // Ensure that the properties were set.
392 assertEq("WEP-PSK", result.WiFi.Security); 397 assertEq(1, result['Priority']);
398 assertTrue('WiFi' in result);
399 assertTrue('AutoConnect' in result['WiFi']);
400 assertEq(true, result['WiFi']['AutoConnect']);
393 // Ensure that the GUID doesn't change. 401 // Ensure that the GUID doesn't change.
394 assertEq(network_guid, result.GUID); 402 assertEq(network_guid, result.GUID);
395 done(); 403 done();
404 }));
405 }));
406 }));
407 },
408 function setVPNProperties() {
409 var done = chrome.test.callbackAdded();
410 var network_guid = "stub_vpn1_guid";
411 chrome.networkingPrivate.getProperties(
412 network_guid,
413 callbackPass(function(result) {
414 assertEq(network_guid, result.GUID);
415 var new_properties = {
416 Priority: 1,
417 VPN: {
418 Host: 'vpn.host1'
419 }
420 };
421 chrome.networkingPrivate.setProperties(
422 network_guid,
423 new_properties,
424 callbackPass(function() {
425 chrome.networkingPrivate.getProperties(
426 network_guid,
427 callbackPass(function(result) {
428 console.log('Result: ' + JSON.stringify(result));
429 // Ensure that the properties were set.
430 assertEq(1, result['Priority']);
431 assertTrue('VPN' in result);
432 assertTrue('Host' in result['VPN']);
433 assertEq('vpn.host1', result['VPN']['Host']);
434 // Ensure that the GUID doesn't change.
435 assertEq(network_guid, result.GUID);
436 done();
396 })); 437 }));
397 })); 438 }));
398 })); 439 }));
399 }, 440 },
400 function getState() { 441 function getState() {
401 chrome.networkingPrivate.getState( 442 chrome.networkingPrivate.getState(
402 "stub_wifi2_guid", 443 "stub_wifi2_guid",
403 callbackPass(function(result) { 444 callbackPass(function(result) {
404 assertEq({ 445 assertEq({
405 "Connectable": true, 446 "Connectable": true,
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 new privateHelpers.watchForCaptivePortalState( 552 new privateHelpers.watchForCaptivePortalState(
512 'wifi_guid', 'Online', done); 553 'wifi_guid', 'Online', done);
513 chrome.test.sendMessage('notifyPortalDetectorObservers'); 554 chrome.test.sendMessage('notifyPortalDetectorObservers');
514 }, 555 },
515 ]; 556 ];
516 557
517 var testToRun = window.location.search.substring(1); 558 var testToRun = window.location.search.substring(1);
518 chrome.test.runTests(availableTests.filter(function(op) { 559 chrome.test.runTests(availableTests.filter(function(op) {
519 return op.name == testToRun; 560 return op.name == testToRun;
520 })); 561 }));
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc ('k') | chromeos/dbus/fake_shill_service_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698