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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 | 417 |
418 /** | 418 /** |
419 * Runs the function and then completes. | 419 * Runs the function and then completes. |
420 */ | 420 */ |
421 start: function() { | 421 start: function() { |
422 this.taskFunction_(); | 422 this.taskFunction_(); |
423 this.onTaskDone(); | 423 this.onTaskDone(); |
424 } | 424 } |
425 }; | 425 }; |
426 | 426 |
| 427 // Creates an incognito window. May not be called if there already is an |
| 428 // incognito in exitence. Returns immediately. |
| 429 function getCreateIncognitoBrowserTask() { |
| 430 return new CallFunctionTask( |
| 431 function() { |
| 432 chrome.send('createIncognitoBrowser'); |
| 433 }); |
| 434 }; |
| 435 |
| 436 // Closes an incognito window created with the task above. May only be |
| 437 // called if there's an incognito window created by the above function |
| 438 // that has yet to be closed. Returns immediately. |
| 439 function getCloseIncognitoBrowserTask() { |
| 440 return new CallFunctionTask( |
| 441 function() { |
| 442 chrome.send('closeIncognitoBrowser'); |
| 443 }); |
| 444 }; |
| 445 |
427 /** | 446 /** |
428 * Returns true if a node does not have a 'display' property of 'none'. | 447 * Returns true if a node does not have a 'display' property of 'none'. |
429 * @param {node}: node The node to check. | 448 * @param {node}: node The node to check. |
430 */ | 449 */ |
431 function isDisplayed(node) { | 450 function isDisplayed(node) { |
432 var style = getComputedStyle(node); | 451 var style = getComputedStyle(node); |
433 return style.getPropertyValue('display') != 'none'; | 452 return style.getPropertyValue('display') != 'none'; |
434 } | 453 } |
435 | 454 |
436 /** | 455 /** |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 return { | 522 return { |
504 test: test, | 523 test: test, |
505 checkStyledTableRows: checkStyledTableRows, | 524 checkStyledTableRows: checkStyledTableRows, |
506 checkTabHandleVisibility: checkTabHandleVisibility, | 525 checkTabHandleVisibility: checkTabHandleVisibility, |
507 getStyledTableText: getStyledTableText, | 526 getStyledTableText: getStyledTableText, |
508 isDisplayed: isDisplayed, | 527 isDisplayed: isDisplayed, |
509 runTest: runTest, | 528 runTest: runTest, |
510 switchToView: switchToView, | 529 switchToView: switchToView, |
511 TaskQueue: TaskQueue, | 530 TaskQueue: TaskQueue, |
512 Task: Task, | 531 Task: Task, |
| 532 CallFunctionTask: CallFunctionTask, |
| 533 getCreateIncognitoBrowserTask: getCreateIncognitoBrowserTask, |
| 534 getCloseIncognitoBrowserTask: getCloseIncognitoBrowserTask, |
513 Source: Source, | 535 Source: Source, |
514 Event: Event, | 536 Event: Event, |
515 CreateBeginEvent: CreateBeginEvent, | 537 CreateBeginEvent: CreateBeginEvent, |
516 CreateEndEvent: CreateEndEvent, | 538 CreateEndEvent: CreateEndEvent, |
517 CreateMatchingEndEvent: CreateMatchingEndEvent | 539 CreateMatchingEndEvent: CreateMatchingEndEvent |
518 }; | 540 }; |
519 })(); | 541 })(); |
520 | 542 |
521 netInternalsTest.test('netInternalsDone', function() { | 543 netInternalsTest.test('netInternalsDone', function() { |
522 testDone(); | 544 testDone(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 HostResolverInfoObserver.prototype.onHostResolverInfoChanged = function() { | 601 HostResolverInfoObserver.prototype.onHostResolverInfoChanged = function() { |
580 assertNotReached(); | 602 assertNotReached(); |
581 }; | 603 }; |
582 | 604 |
583 // Create the observer and add it to |g_browser|. | 605 // Create the observer and add it to |g_browser|. |
584 g_browser.addHostResolverInfoObserver(new HostResolverInfoObserver()); | 606 g_browser.addHostResolverInfoObserver(new HostResolverInfoObserver()); |
585 | 607 |
586 // Needed to trigger an update. | 608 // Needed to trigger an update. |
587 netInternalsTest.switchToView('dns'); | 609 netInternalsTest.switchToView('dns'); |
588 }); | 610 }); |
OLD | NEW |