Closed Bug 757599 Opened 12 years ago Closed 12 years ago

Settings API: add test for closed lock

Categories

(Core :: DOM: Device Interfaces, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla15

People

(Reporter: gwagner, Assigned: gwagner)

Details

Attachments

(1 file)

Attached patch patchSplinter Review
      No description provided.
Attachment #626163 - Flags: review?(jonas)
Assignee: nobody → anygregor
Comment on attachment 626163 [details] [diff] [review]
patch

Review of attachment 626163 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/settings/SettingsManager.js
@@ +122,2 @@
>        throw Components.results.NS_ERROR_ABORT;
> +      return;

The return line won't get executed. The 'throw' call will end execution of the function. So just remove the return statement.

Same in all other changes in this file.

::: dom/settings/tests/test_settings_basics.html
@@ +481,5 @@
> +    var lockx = mozSettings.getLock();
> +    var cb = function() {
> +      var reqx = {};
> +      try {
> +        reqx = lockx.set(wifiNetworks0);

Add a ok(false, "should have thrown") test here

@@ +487,5 @@
> +        ok(true, "Caught Exception");
> +        next();
> +      }
> +      reqx.onsuccess = function () {
> +        ok(false, "Shouldn't get here");

instead of doing this, set reqx to null in the beginning, and check that it's still null inside the catch-block before calling next().

@@ +489,5 @@
> +      }
> +      reqx.onsuccess = function () {
> +        ok(false, "Shouldn't get here");
> +      };
> +      reqx.onerror = onFailure;

And remove this line.

@@ +491,5 @@
> +        ok(false, "Shouldn't get here");
> +      };
> +      reqx.onerror = onFailure;
> +    }
> +    window.setTimeout(cb, 1);

Use SimpleTest.executeSoon()
Attachment #626163 - Flags: review?(jonas) → review+
Summary: Settings API: don't return a request if the lock is closed → Settings API: add test for closed lock
https://hg.mozilla.org/mozilla-central/rev/99878dcae029
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla15
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: