| 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(reset, 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 reset() |
| 509 { |
| 510 Runtime.experiments.clearForTest(); |
| 511 InspectorFrontendHost.getPreferences(gotPreferences); |
| 512 } |
| 513 |
| 514 function gotPreferences(prefs) |
| 515 { |
| 516 WebInspector.Main._instanceForTest._createSettings(prefs); |
| 517 |
| 518 var localSetting = WebInspector.settings.createSetting("local", undefine
d, true); |
| 519 test.assertEquals("object", typeof localSetting.get()); |
| 520 test.assertEquals("local", localSetting.get().s); |
| 521 test.assertEquals(1, localSetting.get().n); |
| 522 var globalSetting = WebInspector.settings.createSetting("global", undefi
ned, false); |
| 523 test.assertEquals("object", typeof globalSetting.get()); |
| 524 test.assertEquals("global", globalSetting.get().s); |
| 525 test.assertEquals(2, globalSetting.get().n); |
| 526 test.releaseControl(); |
| 527 } |
| 528 } |
| 529 |
| 492 TestSuite.prototype.waitForTestResultsInConsole = function() | 530 TestSuite.prototype.waitForTestResultsInConsole = function() |
| 493 { | 531 { |
| 494 var messages = WebInspector.multitargetConsoleModel.messages(); | 532 var messages = WebInspector.multitargetConsoleModel.messages(); |
| 495 for (var i = 0; i < messages.length; ++i) { | 533 for (var i = 0; i < messages.length; ++i) { |
| 496 var text = messages[i].messageText; | 534 var text = messages[i].messageText; |
| 497 if (text === "PASS") | 535 if (text === "PASS") |
| 498 return; | 536 return; |
| 499 else if (/^FAIL/.test(text)) | 537 else if (/^FAIL/.test(text)) |
| 500 this.fail(text); // This will throw. | 538 this.fail(text); // This will throw. |
| 501 } | 539 } |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 } | 707 } |
| 670 | 708 |
| 671 WebInspector.notifications.addEventListener(WebInspector.NotificationService.Eve
nts.InspectorAgentEnabledForTests, runTests); | 709 WebInspector.notifications.addEventListener(WebInspector.NotificationService.Eve
nts.InspectorAgentEnabledForTests, runTests); |
| 672 | 710 |
| 673 return new TestSuite(); | 711 return new TestSuite(); |
| 674 | 712 |
| 675 } | 713 } |
| 676 | 714 |
| 677 if (window.uiTests) | 715 if (window.uiTests) |
| 678 window.uiTests.testSuiteReady(createTestSuite, WebInspector.TestBase); | 716 window.uiTests.testSuiteReady(createTestSuite, WebInspector.TestBase); |
| OLD | NEW |