{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments/48435137","id":48435137,"diff_hunk":"@@ -0,0 +1,148 @@\n+'use strict';\n+\n+var dirapps = require('path').resolve(__dirname + '/../../../');\n+var Settings = require(dirapps + '/settings/test/marionette/app/app'),\n+    LockScreen = require('./lib/lockscreen'),\n+    Promise = require('es6-promise').Promise, // jshint ignore:line\n+    assert = require('assert');\n+\n+marionette('LockScreen > ', function() {\n+  var client = marionette.client({\n+    desiredCapabilities: { raisesAccessibilityExceptions: false }\n+  });\n+  var system;\n+  var settingsApp;\n+  var screenLockPanel;\n+  var lockScreen;\n+\n+  setup(function() {\n+    system = client.loader.getAppClass('system');\n+    lockScreen = (new LockScreen()).start(client);\n+    settingsApp = new Settings(client);\n+    settingsApp.launch();\n+    // Navigate to the ScreenLock menu\n+    screenLockPanel = settingsApp.screenLockPanel;\n+    screenLockPanel.setupScreenLock();\n+    screenLockPanel.toggleScreenLock();\n+    screenLockPanel.togglePasscodeLock();\n+    screenLockPanel.typePasscode('1234', '1234');\n+    screenLockPanel.tapCreatePasscode();\n+    settingsApp.close();\n+    lockScreen.lock();\n+  });\n+\n+  test('slide to invoke passcode panel, then press the camera button ' +\n+       ' to launch the camera app',\n+  function(done) {\n+    client.switchToFrame();\n+    new Promise(function(resolve) {\n+      lockScreen.slideToUnlock(resolve);\n+    })\n+    .then(function() {\n+      var notShownYet = client.executeScript(function() {\n+        return null === window.wrappedJSObject.document\n+          .querySelector('.secureAppWindow.fullscreen-app.active.render');\n+      });\n+      assert.ok(notShownYet);\n+      client.findElement('#lockscreen-alt-camera-button').tap();\n+      client.waitFor(function() {\n+        var theCameraApp = client.executeScript(function() {\n+          return window.wrappedJSObject.document\n+            .querySelector('.secureAppWindow.fullscreen-app.active.render');\n+        });\n+        if (theCameraApp) {\n+          return theCameraApp.displayed();\n+        } else {\n+          return false;\n+        }\n+      });\n+    })\n+    .then(done)\n+    .catch(done);\n+  });\n+\n+  test('after launch the app, press power button twice should dismiss it',\n+  function(done) {\n+    client.switchToFrame();\n+    new Promise(function(resolve) {\n+      lockScreen.slideToUnlock(resolve);\n+    })\n+    .then(function() {\n+      var notShownYet = client.executeScript(function() {\n+        return null === window.wrappedJSObject.document\n+          .querySelector('.secureAppWindow.fullscreen-app.active.render');\n+      });\n+      assert.ok(notShownYet);\n+      client.findElement('#lockscreen-alt-camera-button').tap();\n+      client.waitFor(function() {\n+        var theCameraApp = client.executeScript(function() {\n+          return window.wrappedJSObject.document\n+            .querySelector('.secureAppWindow.fullscreen-app.active.render');\n+        });\n+        if (theCameraApp) {\n+          return theCameraApp.displayed();\n+        } else {\n+          return false;\n+        }\n+      });\n+    })\n+    .then(function() {\n+      client.executeScript(function() {\n+        window.wrappedJSObject.Service.request('turnScreenOff', true);\n+        window.wrappedJSObject.Service.request('turnScreenOn', true);\n+      });\n+      client.waitFor(function() {\n+        var dismissed = client.executeScript(function() {\n+          return null === window.wrappedJSObject.document\n+            .querySelector('.secureAppWindow.fullscreen-app.active.render');\n+        });\n+        return dismissed;\n+      });\n+      assert.ok(!client.findElement('#lockscreen-passcode-code').displayed());\n+    })\n+    .then(done)\n+    .catch(done);\n+  });\n+\n+  test('after launch the app, press home button should dismiss it',\n+  function(done) {\n+    client.switchToFrame();\n+    new Promise(function(resolve) {\n+      lockScreen.slideToUnlock(resolve);\n+    })\n+    .then(function() {\n+      var notShownYet = client.executeScript(function() {\n+        return null === window.wrappedJSObject.document\n+          .querySelector('.secureAppWindow.fullscreen-app.active.render');\n+      });\n+      assert.ok(notShownYet);\n+      client.findElement('#lockscreen-alt-camera-button').tap();\n+      client.waitFor(function() {\n+        var theCameraApp = client.executeScript(function() {\n+          return window.wrappedJSObject.document\n+            .querySelector('.secureAppWindow.fullscreen-app.active.render');\n+        });\n+        if (theCameraApp) {\n+          return theCameraApp.displayed();\n+        } else {\n+          return false;\n+        }\n+      });\n+    })\n+    .then(function() {\n+      client.executeScript(function() {\n+        window.wrappedJSObject.dispatchEvent(new CustomEvent('home'));","path":"apps/system/test/marionette/lockscreen_camera_button_test.js","position":134,"original_position":134,"commit_id":"90a01a8e660609540c467ba3e6f15fb7fc51d6a8","original_commit_id":"90a01a8e660609540c467ba3e6f15fb7fc51d6a8","user":{"login":"timdream","id":93093,"avatar_url":"https://avatars.githubusercontent.com/u/93093?v=3","gravatar_id":"","url":"https://api.github.com/users/timdream","html_url":"https://github.com/timdream","followers_url":"https://api.github.com/users/timdream/followers","following_url":"https://api.github.com/users/timdream/following{/other_user}","gists_url":"https://api.github.com/users/timdream/gists{/gist_id}","starred_url":"https://api.github.com/users/timdream/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timdream/subscriptions","organizations_url":"https://api.github.com/users/timdream/orgs","repos_url":"https://api.github.com/users/timdream/repos","events_url":"https://api.github.com/users/timdream/events{/privacy}","received_events_url":"https://api.github.com/users/timdream/received_events","type":"User","site_admin":false},"body":"I am not entire sure if there is better way to similar this (send mocked key event from Gecko?), but we should do that if there is ...","created_at":"2015-12-25T08:01:31Z","updated_at":"2015-12-25T08:01:31Z","html_url":"https://github.com/mozilla-b2g/gaia/pull/33671#discussion_r48435137","pull_request_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/33671","_links":{"self":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments/48435137"},"html":{"href":"https://github.com/mozilla-b2g/gaia/pull/33671#discussion_r48435137"},"pull_request":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/33671"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/33671","id":54540904,"html_url":"https://github.com/mozilla-b2g/gaia/pull/33671","diff_url":"https://github.com/mozilla-b2g/gaia/pull/33671.diff","patch_url":"https://github.com/mozilla-b2g/gaia/pull/33671.patch","issue_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/33671","number":33671,"state":"open","locked":false,"title":"Bug 1235007 - Add integration test: |lockscreen_camera_button_test.js| to test camera dismissing in secure mode","user":{"login":"snowmantw","id":129153,"avatar_url":"https://avatars.githubusercontent.com/u/129153?v=3","gravatar_id":"","url":"https://api.github.com/users/snowmantw","html_url":"https://github.com/snowmantw","followers_url":"https://api.github.com/users/snowmantw/followers","following_url":"https://api.github.com/users/snowmantw/following{/other_user}","gists_url":"https://api.github.com/users/snowmantw/gists{/gist_id}","starred_url":"https://api.github.com/users/snowmantw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snowmantw/subscriptions","organizations_url":"https://api.github.com/users/snowmantw/orgs","repos_url":"https://api.github.com/users/snowmantw/repos","events_url":"https://api.github.com/users/snowmantw/events{/privacy}","received_events_url":"https://api.github.com/users/snowmantw/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-24T10:02:37Z","updated_at":"2015-12-25T08:01:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5cdb5e2166003d16c1edbeb37143eb0faaca216b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/33671/commits","review_comments_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/33671/comments","review_comment_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/33671/comments","statuses_url":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/90a01a8e660609540c467ba3e6f15fb7fc51d6a8","head":{"label":"snowmantw:bug1235007","ref":"bug1235007","sha":"90a01a8e660609540c467ba3e6f15fb7fc51d6a8","user":{"login":"snowmantw","id":129153,"avatar_url":"https://avatars.githubusercontent.com/u/129153?v=3","gravatar_id":"","url":"https://api.github.com/users/snowmantw","html_url":"https://github.com/snowmantw","followers_url":"https://api.github.com/users/snowmantw/followers","following_url":"https://api.github.com/users/snowmantw/following{/other_user}","gists_url":"https://api.github.com/users/snowmantw/gists{/gist_id}","starred_url":"https://api.github.com/users/snowmantw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snowmantw/subscriptions","organizations_url":"https://api.github.com/users/snowmantw/orgs","repos_url":"https://api.github.com/users/snowmantw/repos","events_url":"https://api.github.com/users/snowmantw/events{/privacy}","received_events_url":"https://api.github.com/users/snowmantw/received_events","type":"User","site_admin":false},"repo":{"id":11719524,"name":"gaia","full_name":"snowmantw/gaia","owner":{"login":"snowmantw","id":129153,"avatar_url":"https://avatars.githubusercontent.com/u/129153?v=3","gravatar_id":"","url":"https://api.github.com/users/snowmantw","html_url":"https://github.com/snowmantw","followers_url":"https://api.github.com/users/snowmantw/followers","following_url":"https://api.github.com/users/snowmantw/following{/other_user}","gists_url":"https://api.github.com/users/snowmantw/gists{/gist_id}","starred_url":"https://api.github.com/users/snowmantw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snowmantw/subscriptions","organizations_url":"https://api.github.com/users/snowmantw/orgs","repos_url":"https://api.github.com/users/snowmantw/repos","events_url":"https://api.github.com/users/snowmantw/events{/privacy}","received_events_url":"https://api.github.com/users/snowmantw/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/snowmantw/gaia","description":"Gaia is a HTML5-based Phone UI for the Boot 2 Gecko Project. NOTE: For details of what branches are used for what releases, see https://wiki.mozilla.org/Release_Management/B2G_Landing","fork":true,"url":"https://api.github.com/repos/snowmantw/gaia","forks_url":"https://api.github.com/repos/snowmantw/gaia/forks","keys_url":"https://api.github.com/repos/snowmantw/gaia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/snowmantw/gaia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/snowmantw/gaia/teams","hooks_url":"https://api.github.com/repos/snowmantw/gaia/hooks","issue_events_url":"https://api.github.com/repos/snowmantw/gaia/issues/events{/number}","events_url":"https://api.github.com/repos/snowmantw/gaia/events","assignees_url":"https://api.github.com/repos/snowmantw/gaia/assignees{/user}","branches_url":"https://api.github.com/repos/snowmantw/gaia/branches{/branch}","tags_url":"https://api.github.com/repos/snowmantw/gaia/tags","blobs_url":"https://api.github.com/repos/snowmantw/gaia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/snowmantw/gaia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/snowmantw/gaia/git/refs{/sha}","trees_url":"https://api.github.com/repos/snowmantw/gaia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/snowmantw/gaia/statuses/{sha}","languages_url":"https://api.github.com/repos/snowmantw/gaia/languages","stargazers_url":"https://api.github.com/repos/snowmantw/gaia/stargazers","contributors_url":"https://api.github.com/repos/snowmantw/gaia/contributors","subscribers_url":"https://api.github.com/repos/snowmantw/gaia/subscribers","subscription_url":"https://api.github.com/repos/snowmantw/gaia/subscription","commits_url":"https://api.github.com/repos/snowmantw/gaia/commits{/sha}","git_commits_url":"https://api.github.com/repos/snowmantw/gaia/git/commits{/sha}","comments_url":"https://api.github.com/repos/snowmantw/gaia/comments{/number}","issue_comment_url":"https://api.github.com/repos/snowmantw/gaia/issues/comments{/number}","contents_url":"https://api.github.com/repos/snowmantw/gaia/contents/{+path}","compare_url":"https://api.github.com/repos/snowmantw/gaia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/snowmantw/gaia/merges","archive_url":"https://api.github.com/repos/snowmantw/gaia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/snowmantw/gaia/downloads","issues_url":"https://api.github.com/repos/snowmantw/gaia/issues{/number}","pulls_url":"https://api.github.com/repos/snowmantw/gaia/pulls{/number}","milestones_url":"https://api.github.com/repos/snowmantw/gaia/milestones{/number}","notifications_url":"https://api.github.com/repos/snowmantw/gaia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/snowmantw/gaia/labels{/name}","releases_url":"https://api.github.com/repos/snowmantw/gaia/releases{/id}","created_at":"2013-07-28T12:37:37Z","updated_at":"2014-07-03T00:59:35Z","pushed_at":"2015-12-25T03:30:58Z","git_url":"git://github.com/snowmantw/gaia.git","ssh_url":"git@github.com:snowmantw/gaia.git","clone_url":"https://github.com/snowmantw/gaia.git","svn_url":"https://github.com/snowmantw/gaia","homepage":"https://wiki.mozilla.org/B2G","size":991209,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla-b2g:master","ref":"master","sha":"adf75f7a97ea0627b3211f0eef61eb72073f2dff","user":{"login":"mozilla-b2g","id":1261292,"avatar_url":"https://avatars.githubusercontent.com/u/1261292?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-b2g","html_url":"https://github.com/mozilla-b2g","followers_url":"https://api.github.com/users/mozilla-b2g/followers","following_url":"https://api.github.com/users/mozilla-b2g/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-b2g/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-b2g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-b2g/subscriptions","organizations_url":"https://api.github.com/users/mozilla-b2g/orgs","repos_url":"https://api.github.com/users/mozilla-b2g/repos","events_url":"https://api.github.com/users/mozilla-b2g/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-b2g/received_events","type":"Organization","site_admin":false},"repo":{"id":2317369,"name":"gaia","full_name":"mozilla-b2g/gaia","owner":{"login":"mozilla-b2g","id":1261292,"avatar_url":"https://avatars.githubusercontent.com/u/1261292?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-b2g","html_url":"https://github.com/mozilla-b2g","followers_url":"https://api.github.com/users/mozilla-b2g/followers","following_url":"https://api.github.com/users/mozilla-b2g/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-b2g/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-b2g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-b2g/subscriptions","organizations_url":"https://api.github.com/users/mozilla-b2g/orgs","repos_url":"https://api.github.com/users/mozilla-b2g/repos","events_url":"https://api.github.com/users/mozilla-b2g/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-b2g/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-b2g/gaia","description":"Gaia is a HTML5-based Phone UI for the Boot 2 Gecko Project. NOTE: For details of what branches are used for what releases, see","fork":false,"url":"https://api.github.com/repos/mozilla-b2g/gaia","forks_url":"https://api.github.com/repos/mozilla-b2g/gaia/forks","keys_url":"https://api.github.com/repos/mozilla-b2g/gaia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-b2g/gaia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-b2g/gaia/teams","hooks_url":"https://api.github.com/repos/mozilla-b2g/gaia/hooks","issue_events_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-b2g/gaia/events","assignees_url":"https://api.github.com/repos/mozilla-b2g/gaia/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-b2g/gaia/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-b2g/gaia/tags","blobs_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-b2g/gaia/languages","stargazers_url":"https://api.github.com/repos/mozilla-b2g/gaia/stargazers","contributors_url":"https://api.github.com/repos/mozilla-b2g/gaia/contributors","subscribers_url":"https://api.github.com/repos/mozilla-b2g/gaia/subscribers","subscription_url":"https://api.github.com/repos/mozilla-b2g/gaia/subscription","commits_url":"https://api.github.com/repos/mozilla-b2g/gaia/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-b2g/gaia/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla-b2g/gaia/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-b2g/gaia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-b2g/gaia/merges","archive_url":"https://api.github.com/repos/mozilla-b2g/gaia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-b2g/gaia/downloads","issues_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-b2g/gaia/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-b2g/gaia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-b2g/gaia/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-b2g/gaia/releases{/id}","created_at":"2011-09-03T01:38:46Z","updated_at":"2015-12-24T22:43:39Z","pushed_at":"2015-12-25T07:05:52Z","git_url":"git://github.com/mozilla-b2g/gaia.git","ssh_url":"git@github.com:mozilla-b2g/gaia.git","clone_url":"https://github.com/mozilla-b2g/gaia.git","svn_url":"https://github.com/mozilla-b2g/gaia","homepage":"https://wiki.mozilla.org/B2G","size":1199464,"stargazers_count":2026,"watchers_count":2026,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":2576,"mirror_url":null,"open_issues_count":1290,"forks":2576,"open_issues":1290,"watchers":2026,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/33671"},"html":{"href":"https://github.com/mozilla-b2g/gaia/pull/33671"},"issue":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/issues/33671"},"comments":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/issues/33671/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/33671/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/33671/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/90a01a8e660609540c467ba3e6f15fb7fc51d6a8"}}}}