forked from benmccann/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set display mode for extensions::AppWindow
This CL provides content::WebContentsDelegate::GetDisplayMode() implementation for extensions::AppWindow. The 'extensions/api_test/fullscreen/' test is modified to verify media query "display-mode" features correctness. BUG=471703 Review URL: https://codereview.chromium.org/1070423003 Cr-Commit-Position: refs/heads/master@{#326502}
- Loading branch information
mikhail.pozdnyakov
authored and
Commit bot
committed
Apr 23, 2015
1 parent
62215af
commit d15048d
Showing
9 changed files
with
97 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
chrome/test/data/extensions/api_test/fullscreen/mq_display_mode/background.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright (c) 2013 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
chrome.app.runtime.onLaunched.addListener(function() { | ||
chrome.app.window.create('window.html'); | ||
}); |
12 changes: 12 additions & 0 deletions
12
chrome/test/data/extensions/api_test/fullscreen/mq_display_mode/manifest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "App window, 'display-mode' media feature test", | ||
"description": "tests the 'display mode' media feature for the fullscreened app window", | ||
"version": "1", | ||
"manifest_version": 2, | ||
"app": { | ||
"background": { | ||
"scripts": ["background.js"] | ||
} | ||
}, | ||
"permissions": [ ] | ||
} |
10 changes: 10 additions & 0 deletions
10
chrome/test/data/extensions/api_test/fullscreen/mq_display_mode/window.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!-- | ||
* Copyright (c) 2012 The Chromium Authors. All rights reserved. Use of this | ||
* source code is governed by a BSD-style license that can be found in the | ||
* LICENSE file. | ||
--> | ||
<html> | ||
<body> | ||
<script src="window.js"></script> | ||
</body> | ||
</html> |
30 changes: 30 additions & 0 deletions
30
chrome/test/data/extensions/api_test/fullscreen/mq_display_mode/window.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (c) 2015 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
function checkWindowRestored() { | ||
var standalone = matchMedia( '(display-mode: standalone)' ); | ||
chrome.test.assertTrue(standalone.matches, | ||
"Display mode of the restored window is 'standalone'"); | ||
|
||
chrome.test.succeed(); | ||
} | ||
|
||
function checkWindowFullscreened() { | ||
var fullscreen = matchMedia( '(display-mode: fullscreen)' ); | ||
chrome.test.assertTrue(fullscreen.matches, | ||
"Display mode of the fullscreened window is 'fullscreen'"); | ||
|
||
window.onresize = checkWindowRestored; | ||
chrome.app.window.current().restore(); | ||
} | ||
|
||
window.onload = function() { | ||
function checkDisplayModeMediaFeature() { | ||
var standalone = matchMedia( '(display-mode: standalone)' ); | ||
chrome.test.assertTrue(standalone.matches, | ||
"Initially display mode is 'standalone'"); | ||
window.onresize = checkWindowFullscreened; | ||
chrome.app.window.current().fullscreen(); | ||
}; | ||
chrome.test.runTests([checkDisplayModeMediaFeature]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
<html><head></head><body></body></html> | ||
<html> | ||
<head></head> | ||
<body></body> | ||
<script src="check_media_feature.js" type="text/javascript"></script> | ||
</html> |
13 changes: 13 additions & 0 deletions
13
chrome/test/data/extensions/fullscreen_app/check_media_feature.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright 2015 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
var fullscreen = matchMedia( '(display-mode: fullscreen)' ); | ||
var p = document.createElement("p"); | ||
document.body.appendChild(p); | ||
if (fullscreen.matches) { | ||
p.innerHTML = "(display-mode: fullscreen) matches."; | ||
p.style.color = "green"; | ||
} else { | ||
p.innerHTML = "(display-mode: fullscreen) does not match."; | ||
p.style.color = "red"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters