Commit 9e974839 authored by Makoto Kato's avatar Makoto Kato
Browse files

Bug 1750142 - Support screen.orientation.lock('any') on GeckoView backend....

Bug 1750142 - Support screen.orientation.lock('any') on GeckoView backend. r=geckoview-reviewers,calu

Differential Revision: https://phabricator.services.mozilla.com/D135981
parent b894f994
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -114,6 +114,10 @@ RefPtr<MozPromise<bool, bool, false>> LockScreenOrientation(
    case eScreenOrientation_LandscapeSecondary:
    case eScreenOrientation_LandscapePrimary |
        eScreenOrientation_LandscapeSecondary:
    case eScreenOrientation_PortraitPrimary |
        eScreenOrientation_PortraitSecondary |
        eScreenOrientation_LandscapePrimary |
        eScreenOrientation_LandscapeSecondary:
    case eScreenOrientation_Default: {
      java::GeckoRuntime::LocalRef runtime = java::GeckoRuntime::GetInstance();
      if (runtime != NULL) {
+5 −0
Original line number Diff line number Diff line
@@ -36,6 +36,11 @@ public class GeckoScreenOrientation {
    LANDSCAPE_PRIMARY(1 << 2),
    LANDSCAPE_SECONDARY(1 << 3),
    LANDSCAPE(LANDSCAPE_PRIMARY.value | LANDSCAPE_SECONDARY.value),
    ANY(
        PORTRAIT_PRIMARY.value
            | PORTRAIT_SECONDARY.value
            | LANDSCAPE_PRIMARY.value
            | LANDSCAPE_SECONDARY.value),
    DEFAULT(1 << 4);

    public final short value;
+2 −0
Original line number Diff line number Diff line
@@ -873,6 +873,8 @@ public final class GeckoRuntime implements Parcelable {
      return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
    } else if (geckoOrientation == ScreenOrientation.DEFAULT.value) {
      return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
    } else if (geckoOrientation == ScreenOrientation.ANY.value) {
      return ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR;
    }
    return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
  }
+8 −2
Original line number Diff line number Diff line
[lock-basic.html]
  prefs: [dom.screenorientation.allow-lock:true]
  expected: ERROR
  [Test that screen.orientation.lock returns a pending promise.]
    expected: FAIL
    expected:
      if (os == "android"): TIMEOUT # Bug 1750147
      FAIL

  [Test that screen.orientation.lock returns a promise which will be fulfilled with a void value.]
    expected: FAIL
    expected:
      if (os == "android"): PASS
      FAIL

  [Test that screen.orientation.lock() is actually async]
    expected:
      if (os == "android"): [PASS, NOTRUN]
      FAIL