OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 /** | 5 /** |
6 * @fileoverview The way these tests work is as follows: | 6 * @fileoverview The way these tests work is as follows: |
7 * C++ in net_internals_ui_browsertest.cc does any necessary setup, and then | 7 * C++ in net_internals_ui_browsertest.cc does any necessary setup, and then |
8 * calls the entry point for a test with RunJavascriptTest. The called | 8 * calls the entry point for a test with RunJavascriptTest. The called |
9 * function can then use the assert/expect functions defined in test_api.js. | 9 * function can then use the assert/expect functions defined in test_api.js. |
10 * All callbacks from the browser are wrapped in such a way that they can | 10 * All callbacks from the browser are wrapped in such a way that they can |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
416 | 416 |
417 /** | 417 /** |
418 * Runs the function and then completes. | 418 * Runs the function and then completes. |
419 */ | 419 */ |
420 start: function() { | 420 start: function() { |
421 this.taskFunction_(); | 421 this.taskFunction_(); |
422 this.onTaskDone(); | 422 this.onTaskDone(); |
423 } | 423 } |
424 }; | 424 }; |
425 | 425 |
426 // Creates an incognito window. May not be called if there already is an | |
427 // incognito in exitence. Returns immediately. | |
mmenke
2011/12/05 18:59:54
Added these here because if/when/whatever I added
| |
428 function getCreateIncognitoBrowserTask() { | |
429 return new CallFunctionTask( | |
430 function() { | |
431 chrome.send('createIncognitoBrowser'); | |
432 }); | |
433 }; | |
434 | |
435 // Closes an incognito window created with the task above. May only be | |
436 // called if there's an incognito window created by the above function | |
437 // that has yet to be closed. Returns immediately. | |
438 function getCloseIncognitoBrowserTask() { | |
439 return new CallFunctionTask( | |
440 function() { | |
441 chrome.send('closeIncognitoBrowser'); | |
442 }); | |
443 }; | |
444 | |
426 /** | 445 /** |
427 * Returns true if a node does not have a 'display' property of 'none'. | 446 * Returns true if a node does not have a 'display' property of 'none'. |
428 * @param {node}: node The node to check. | 447 * @param {node}: node The node to check. |
429 */ | 448 */ |
430 function isDisplayed(node) { | 449 function isDisplayed(node) { |
431 var style = getComputedStyle(node); | 450 var style = getComputedStyle(node); |
432 return style.getPropertyValue('display') != 'none'; | 451 return style.getPropertyValue('display') != 'none'; |
433 } | 452 } |
434 | 453 |
435 /** | 454 /** |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
502 return { | 521 return { |
503 test: test, | 522 test: test, |
504 checkStyledTableRows: checkStyledTableRows, | 523 checkStyledTableRows: checkStyledTableRows, |
505 checkTabHandleVisibility: checkTabHandleVisibility, | 524 checkTabHandleVisibility: checkTabHandleVisibility, |
506 getStyledTableText: getStyledTableText, | 525 getStyledTableText: getStyledTableText, |
507 isDisplayed: isDisplayed, | 526 isDisplayed: isDisplayed, |
508 runTest: runTest, | 527 runTest: runTest, |
509 switchToView: switchToView, | 528 switchToView: switchToView, |
510 TaskQueue: TaskQueue, | 529 TaskQueue: TaskQueue, |
511 Task: Task, | 530 Task: Task, |
531 CallFunctionTask: CallFunctionTask, | |
532 getCreateIncognitoBrowserTask: getCreateIncognitoBrowserTask, | |
533 getCloseIncognitoBrowserTask: getCloseIncognitoBrowserTask, | |
512 Source: Source, | 534 Source: Source, |
513 Event: Event, | 535 Event: Event, |
514 CreateBeginEvent: CreateBeginEvent, | 536 CreateBeginEvent: CreateBeginEvent, |
515 CreateEndEvent: CreateEndEvent, | 537 CreateEndEvent: CreateEndEvent, |
516 CreateMatchingEndEvent: CreateMatchingEndEvent | 538 CreateMatchingEndEvent: CreateMatchingEndEvent |
517 }; | 539 }; |
518 })(); | 540 })(); |
519 | 541 |
520 netInternalsTest.test('netInternalsDone', function() { | 542 netInternalsTest.test('netInternalsDone', function() { |
521 testDone(); | 543 testDone(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
578 HostResolverInfoObserver.prototype.onHostResolverInfoChanged = function() { | 600 HostResolverInfoObserver.prototype.onHostResolverInfoChanged = function() { |
579 assertNotReached(); | 601 assertNotReached(); |
580 }; | 602 }; |
581 | 603 |
582 // Create the observer and add it to |g_browser|. | 604 // Create the observer and add it to |g_browser|. |
583 g_browser.addHostResolverInfoObserver(new HostResolverInfoObserver()); | 605 g_browser.addHostResolverInfoObserver(new HostResolverInfoObserver()); |
584 | 606 |
585 // Needed to trigger an update. | 607 // Needed to trigger an update. |
586 netInternalsTest.switchToView('dns'); | 608 netInternalsTest.switchToView('dns'); |
587 }); | 609 }); |
OLD | NEW |