fix code style
This commit is contained in:
parent
f124732431
commit
5d94221c61
2 changed files with 10 additions and 2 deletions
|
@ -554,8 +554,16 @@ void Session::CreateInterruptedDownload(const mate::Dictionary& options) {
|
||||||
options.Get("lastModified", &last_modified);
|
options.Get("lastModified", &last_modified);
|
||||||
options.Get("eTag", &etag);
|
options.Get("eTag", &etag);
|
||||||
options.Get("startTime", &start_time);
|
options.Get("startTime", &start_time);
|
||||||
if (path.empty() || url_chain.empty() || length == 0 || offset >= length)
|
if (path.empty() || url_chain.empty() || length == 0) {
|
||||||
|
isolate()->ThrowException(v8::Exception::Error(mate::StringToV8(
|
||||||
|
isolate(), "Must pass non-empty path, urlChain and length.")));
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
if (offset >= length) {
|
||||||
|
isolate()->ThrowException(v8::Exception::Error(mate::StringToV8(
|
||||||
|
isolate(), "Must pass an offset value less than length.")));
|
||||||
|
return;
|
||||||
|
}
|
||||||
auto download_manager =
|
auto download_manager =
|
||||||
content::BrowserContext::GetDownloadManager(browser_context());
|
content::BrowserContext::GetDownloadManager(browser_context());
|
||||||
download_manager->GetDelegate()->GetNextId(base::Bind(
|
download_manager->GetDelegate()->GetNextId(base::Bind(
|
||||||
|
|
|
@ -601,7 +601,7 @@ describe('session module', function () {
|
||||||
totalBytes, filename,
|
totalBytes, filename,
|
||||||
savePath) {
|
savePath) {
|
||||||
assert.equal(state, 'interrupted')
|
assert.equal(state, 'interrupted')
|
||||||
assert.equal(urlChain, urlChain)
|
assert.deepEqual(urlChain, urlChain)
|
||||||
assert.equal(mimeType, 'application/pdf')
|
assert.equal(mimeType, 'application/pdf')
|
||||||
assert.equal(receivedBytes, 0)
|
assert.equal(receivedBytes, 0)
|
||||||
assert.equal(totalBytes, 5242880)
|
assert.equal(totalBytes, 5242880)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue