Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / script-tests / canvas-gradient-addStop-error.js
blob8ea4f5cff26bed7bad9b0bde34c5bc9faee485cb
1 description("A couple of tests to ensure that adding a stop with an invalid color to a gradient throws exceptions normally, but not in dashboard.");
2 debug("Ensure exceptions are thrown in normal pages");
3 var ctx = document.createElement('canvas').getContext('2d');
4 var gradient = ctx.createLinearGradient(0, 0, 0, 100);
5 shouldThrow("gradient.addColorStop(1, 'rgb(NaN%, NaN%, NaN%)')");
6 var gradient = ctx.createRadialGradient(0, 0, 0, 100, 0, 0);
7 shouldThrow("gradient.addColorStop(1, 'rgb(NaN%, NaN%, NaN%)')");
9 if (this.testRunner) {
10 debug("Switching to dashboard compatibility mode. Invalid color strings should no longer cause an exception.");
11 testRunner.setUseDashboardCompatibilityMode(true);
12 } else {
13 debug("The following tests will fail in the browser as we can only enable dashboard compatibility mode in DRT.")
15 // Create a new context so that will be created using dashboard compatibility mode.
16 ctx = document.createElement('canvas').getContext('2d');
17 var gradient = ctx.createLinearGradient(0, 0, 0, 100);
18 shouldBeUndefined("gradient.addColorStop(1, 'rgb(NaN%, NaN%, NaN%)')");
19 var gradient = ctx.createRadialGradient(0, 0, 0, 100, 0, 0);
20 shouldBeUndefined("gradient.addColorStop(1, 'rgb(NaN%, NaN%, NaN%)')");