Commit c62ed3ea authored by sky@chromium.org's avatar sky@chromium.org

Revert 251087 "Add wallpaper api tests"

> Add wallpaper api tests
> 
> This CL add the following tests:
> 1. test chrome.setWallpaper can set ChromeOS wallpaper from jpg or png formatted arraybuffer.
> 2. test chrome.setWallpaper can set ChromeOS wallpaper from a valid url that point to a jpg or png image.
> 3. test an invalide URL wont set wallpaper
> 4. test a new wallpaper request will cancel previous unfinished request
> 
> 
> BUG=176183
> 
> Review URL: https://codereview.chromium.org/153093010

AFAICT this failed as soon as you landed it.

Here's output from one of the bots:

ExtensionApiTest.Wallpaper (run #1):
[ RUN      ] ExtensionApiTest.Wallpaper
[21364:21364:0213/150838:1514562885:ERROR:audio_manager_pulse.cc(248)]
Failed to connect to the context.  Error: Connection refused
Xlib:  extension "RANDR" missing on display ":9".
[7:7:0213/150839:WARNING:sandbox_linux.cc(55)] Activated seccomp-bpf
sandbox for process type: renderer.
[21409:21409:0213/230839:WARNING:sandbox_linux.cc(55)] Activated
seccomp-bpf sandbox for process type: gpu-process.
[15:15:0213/150840:WARNING:sandbox_linux.cc(55)] Activated seccomp-bpf
sandbox for process type: renderer.
[24:24:0213/150840:WARNING:sandbox_linux.cc(55)] Activated seccomp-bpf
sandbox for process type: utility.
Corrupt JPEG data: premature end of data segment
[21364:21364:0213/150841:1516721525:INFO:CONSOLE(0)] "[SUCCESS]
setJpgWallpaperFromAppLocalFile", source:
chrome-extension://neonnameailmmllmeicdbcndfninlogd/_generated_background_page.html
(0)
[31:31:0213/150841:WARNING:sandbox_linux.cc(55)] Activated seccomp-bpf
sandbox for process type: utility.
[21364:21364:0213/150841:1516803158:INFO:CONSOLE(0)] "[SUCCESS]
setPngWallpaperFromAppLocalFile", source:
chrome-extension://neonnameailmmllmeicdbcndfninlogd/_generated_background_page.html
(0)
[38:38:0213/150841:WARNING:sandbox_linux.cc(55)] Activated seccomp-bpf
sandbox for process type: utility.
Corrupt JPEG data: premature end of data segment
[21364:21364:0213/150841:1517187827:INFO:CONSOLE(0)] "[SUCCESS]
setJpgWallpaperFromURL", source:
chrome-extension://neonnameailmmllmeicdbcndfninlogd/_generated_background_page.html
(0)
[45:45:0213/150841:WARNING:sandbox_linux.cc(55)] Activated seccomp-bpf
sandbox for process type: utility.
[21364:21364:0213/150841:1517523379:INFO:CONSOLE(0)] "[SUCCESS]
setPngWallpaperFromURL", source:
chrome-extension://neonnameailmmllmeicdbcndfninlogd/_generated_background_page.html
(0)
[21364:21446:0213/150841:1517544840:WARNING:embedded_test_server.cc(231)]
Request not handled. Returning 404:
/extensions/api_test/wallpaper/test1.jpg
[52:52:0213/150841:WARNING:sandbox_linux.cc(55)] Activated seccomp-bpf
sandbox for process type: utility.
/usr/include/c++/4.6/debug/vector:320:error: attempt to subscript
container 
    with out-of-bounds index 0, but container only holds 0 elements.

Objects involved in the operation:
sequence "this" @ 0x0x7ffffdb6a470 {
}

at: http://build.chromium.org/p/chromium.chromiumos/builders/Linux%20ChromiumOS%20Tests%20%28dbg%29%282%29/builds/10341/steps/browser_tests/logs/Wallpaper

TBR=bshe@chromium.org

Review URL: https://codereview.chromium.org/167243002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251366 0039d316-1c4b-4281-b951-d872f2087c98
parent 425aa6f8
// Copyright 2014 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.
#include "chrome/browser/extensions/extension_apitest.h"
#include "net/dns/mock_host_resolver.h"
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Wallpaper) {
host_resolver()->AddRule("a.com", "127.0.0.1");
ASSERT_TRUE(StartEmbeddedTestServer());
ASSERT_TRUE(RunExtensionTest("wallpaper")) << message_;
}
...@@ -1036,7 +1036,6 @@ ...@@ -1036,7 +1036,6 @@
'browser/chromeos/extensions/info_private_apitest.cc', 'browser/chromeos/extensions/info_private_apitest.cc',
'browser/chromeos/extensions/input_method_apitest_chromeos.cc', 'browser/chromeos/extensions/input_method_apitest_chromeos.cc',
'browser/chromeos/extensions/virtual_keyboard_browsertest.cc', 'browser/chromeos/extensions/virtual_keyboard_browsertest.cc',
'browser/chromeos/extensions/wallpaper_apitest.cc',
'browser/chromeos/extensions/wallpaper_private_apitest.cc', 'browser/chromeos/extensions/wallpaper_private_apitest.cc',
'browser/chromeos/file_manager/drive_test_util.cc', 'browser/chromeos/file_manager/drive_test_util.cc',
'browser/chromeos/file_manager/drive_test_util.h', 'browser/chromeos/file_manager/drive_test_util.h',
......
{
"name": "chrome.wallpaper API Test Extension",
"version": "1.0",
"manifest_version": 2,
"app": {
"background": {
"scripts": ["test.js"]
}
},
"permissions": [
"wallpaper"
]
}
// Copyright 2014 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 pass = chrome.test.callbackPass;
var fail = chrome.test.callbackFail;
chrome.test.getConfig(function(config) {
var baseURL = "http://a.com:" + config.testServer.port +
"/extensions/api_test/wallpaper/";
/*
* Calls chrome.wallpaper.setWallpaper using an arraybuffer.
* @param {string} filePath An extension relative file path.
*/
var testSetWallpaperFromArrayBuffer = function (filePath) {
// Loads an extension local file to an arraybuffer.
var url = chrome.runtime.getURL(filePath);
var wallpaperRequest = new XMLHttpRequest();
wallpaperRequest.open('GET', url, true);
wallpaperRequest.responseType = 'arraybuffer';
try {
wallpaperRequest.send(null);
wallpaperRequest.onloadend = function(e) {
if (wallpaperRequest.status === 200) {
chrome.wallpaper.setWallpaper(
{'wallpaperData': wallpaperRequest.response,
'layout': 'CENTER_CROPPED',
'name': 'test'},
// Set wallpaper directly with an arraybuffer should pass.
pass()
);
} else {
chrome.test.fail('Failed to load local file: ' + filePath + '.');
}
};
} catch (e) {
console.error(e);
chrome.test.fail('An error thrown when requesting wallpaper.');
}
};
/*
* Calls chrome.wallpaper.setWallpaper using an URL.
* @param {string} relativeURL The relative URL of an online image.
* @param {boolean} success True if expecting the API call success.
* @param {string=} optExpectedError The expected error string if API call
* failed. An error string must be provided if success is set to false.
*/
var testSetWallpaperFromURL = function (relativeURL,
success,
optExpectedError) {
var url = baseURL + relativeURL;
if (success) {
chrome.wallpaper.setWallpaper(
{'url': url,
'layout': 'CENTER_CROPPED',
'name': 'test'},
// A valid url should set wallpaper correctly.
pass()
);
} else {
if (optExpectedError == undefined) {
chrome.test.fail('No expected error string is provided.');
return;
}
chrome.wallpaper.setWallpaper(
{'url': url,
'layout': 'CENTER_CROPPED',
'name': 'test'},
// Expect a failure.
fail(optExpectedError));
}
};
chrome.test.runTests([
function setJpgWallpaperFromAppLocalFile() {
testSetWallpaperFromArrayBuffer('test.jpg');
},
function setPngWallpaperFromAppLocalFile() {
testSetWallpaperFromArrayBuffer('test.png');
},
function setJpgWallpaperFromURL () {
testSetWallpaperFromURL('test.jpg', true);
},
function setPngWallpaperFromURL () {
testSetWallpaperFromURL('test.png', true);
},
function setNoExistingWallpaperFromURL () {
// test1.jpg doesn't exist. Expect Chrome cannot set wallpaper failure.
testSetWallpaperFromURL('test1.jpg',
false,
'Chrome cannot set wallpaper.');
},
function newRequestCancelPreviousRequest() {
// The first request should be canceled.
testSetWallpaperFromURL('test.png',
false,
'Downloading wallpaper test.png is canceled.');
testSetWallpaperFromURL('test.jpg', true);
}
]);
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment