| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 function finish() | 482 function finish() |
| 483 { | 483 { |
| 484 test.releaseControl(); | 484 test.releaseControl(); |
| 485 } | 485 } |
| 486 | 486 |
| 487 WebInspector.overridesSupport._deviceMetricsChangedListenerMuted = true; | 487 WebInspector.overridesSupport._deviceMetricsChangedListenerMuted = true; |
| 488 test.takeControl(); | 488 test.takeControl(); |
| 489 this.waitForThrottler(WebInspector.overridesSupport._deviceMetricsThrottler,
step1); | 489 this.waitForThrottler(WebInspector.overridesSupport._deviceMetricsThrottler,
step1); |
| 490 }; | 490 }; |
| 491 | 491 |
| 492 TestSuite.prototype.testSettings = function() |
| 493 { |
| 494 var test = this; |
| 495 |
| 496 createSettings(); |
| 497 test.takeControl(); |
| 498 setTimeout(resetAndCheck, 0); |
| 499 |
| 500 function createSettings() |
| 501 { |
| 502 var localSetting = WebInspector.settings.createSetting("local", undefine
d, true); |
| 503 localSetting.set({s: "local", n: 1 }); |
| 504 var globalSetting = WebInspector.settings.createSetting("global", undefi
ned, false); |
| 505 globalSetting.set({s: "global", n: 2 }); |
| 506 } |
| 507 |
| 508 function resetAndCheck() |
| 509 { |
| 510 WebInspector.Main._instance._resetSettingsForTest(checkSettings); |
| 511 } |
| 512 |
| 513 function checkSettings() |
| 514 { |
| 515 var localSetting = WebInspector.settings.createSetting("local", undefine
d, true); |
| 516 test.assertEquals("object", typeof localSetting.get()); |
| 517 test.assertEquals("local", localSetting.get().s); |
| 518 test.assertEquals(1, localSetting.get().n); |
| 519 var globalSetting = WebInspector.settings.createSetting("global", undefi
ned, false); |
| 520 test.assertEquals("object", typeof globalSetting.get()); |
| 521 test.assertEquals("global", globalSetting.get().s); |
| 522 test.assertEquals(2, globalSetting.get().n); |
| 523 test.releaseControl(); |
| 524 } |
| 525 } |
| 526 |
| 492 TestSuite.prototype.waitForTestResultsInConsole = function() | 527 TestSuite.prototype.waitForTestResultsInConsole = function() |
| 493 { | 528 { |
| 494 var messages = WebInspector.multitargetConsoleModel.messages(); | 529 var messages = WebInspector.multitargetConsoleModel.messages(); |
| 495 for (var i = 0; i < messages.length; ++i) { | 530 for (var i = 0; i < messages.length; ++i) { |
| 496 var text = messages[i].messageText; | 531 var text = messages[i].messageText; |
| 497 if (text === "PASS") | 532 if (text === "PASS") |
| 498 return; | 533 return; |
| 499 else if (/^FAIL/.test(text)) | 534 else if (/^FAIL/.test(text)) |
| 500 this.fail(text); // This will throw. | 535 this.fail(text); // This will throw. |
| 501 } | 536 } |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 } | 704 } |
| 670 | 705 |
| 671 WebInspector.notifications.addEventListener(WebInspector.NotificationService.Eve
nts.InspectorAgentEnabledForTests, runTests); | 706 WebInspector.notifications.addEventListener(WebInspector.NotificationService.Eve
nts.InspectorAgentEnabledForTests, runTests); |
| 672 | 707 |
| 673 return new TestSuite(); | 708 return new TestSuite(); |
| 674 | 709 |
| 675 } | 710 } |
| 676 | 711 |
| 677 if (window.uiTests) | 712 if (window.uiTests) |
| 678 window.uiTests.testSuiteReady(createTestSuite, WebInspector.TestBase); | 713 window.uiTests.testSuiteReady(createTestSuite, WebInspector.TestBase); |
| OLD | NEW |