mirror of
https://github.com/servo/servo.git
synced 2025-08-15 18:35:33 +01:00
Add unit testing to file manager; Replace uuid by stringified version in FileManagerThreadMsg
This commit is contained in:
parent
3977128d7e
commit
f8fa9aaf42
7 changed files with 100 additions and 73 deletions
|
@ -2,7 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use std::str::FromStr;
|
||||
use url::Url;
|
||||
use uuid::Uuid;
|
||||
|
@ -29,13 +28,6 @@ pub struct BlobURLStoreEntry {
|
|||
pub bytes: Vec<u8>,
|
||||
}
|
||||
|
||||
/// Message-passing style interface between store and loader
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub enum BlobURLStoreMsg {
|
||||
/// Request for an blob entry identified by uuid
|
||||
Request(Uuid, IpcSender<Result<BlobURLStoreEntry, BlobURLStoreError>>),
|
||||
}
|
||||
|
||||
/// Parse URL as Blob URL scheme's definition
|
||||
/// https://w3c.github.io/FileAPI/#DefinitionOfScheme
|
||||
pub fn parse_blob_url(url: &Url) -> Option<(Uuid, Option<&str>)> {
|
||||
|
|
|
@ -5,11 +5,13 @@
|
|||
use ipc_channel::ipc::IpcSender;
|
||||
use std::path::PathBuf;
|
||||
use super::{LoadConsumer, LoadData};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct SelectedFileId(pub String);
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct SelectedFile {
|
||||
pub id: Uuid,
|
||||
pub id: SelectedFileId,
|
||||
pub filename: PathBuf,
|
||||
pub modified: u64,
|
||||
// https://w3c.github.io/FileAPI/#dfn-type
|
||||
|
@ -25,10 +27,10 @@ pub enum FileManagerThreadMsg {
|
|||
SelectFiles(IpcSender<FileManagerResult<Vec<SelectedFile>>>),
|
||||
|
||||
/// Read file, return the bytes
|
||||
ReadFile(IpcSender<FileManagerResult<Vec<u8>>>, Uuid),
|
||||
ReadFile(IpcSender<FileManagerResult<Vec<u8>>>, SelectedFileId),
|
||||
|
||||
/// Delete the FileID entry
|
||||
DeleteFileID(Uuid),
|
||||
DeleteFileID(SelectedFileId),
|
||||
|
||||
/// Load resource by Blob URL
|
||||
LoadBlob(LoadData, LoadConsumer),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue