Page Speed Optimization Libraries  1.4.26.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Protected Member Functions | Protected Attributes
net_instaweb::FileSystemTest Class Reference

#include "file_system_test.h"

List of all members.

Protected Member Functions

void CheckDoesNotExist (const GoogleString &filename)
void CheckRead (const GoogleString &filename, const GoogleString &expected_contents)
void CheckInputFileRead (const GoogleString &filename, const GoogleString &expected_contents)
virtual void DeleteRecursively (const StringPiece &filename)=0
virtual FileSystemfile_system ()=0
 Provide a pointer to your favorite filesystem implementation.
virtual Timertimer ()=0
 Pointer to a timer to use in tests.
const GoogleStringtest_tmpdir ()
 Provide a temporary directory for tests to put files in.
GoogleString WriteNewFile (const StringPiece &suffix, const GoogleString &content)
virtual int FileSize (StringPiece contents) const =0
int FileContentSize (StringPiece contents) const
int FileBlockSize (StringPiece contents, int64 default_file_size) const
virtual int DefaultDirSize () const =0
void TestWriteRead ()
void TestTemp ()
void TestAppend ()
void TestRename ()
void TestRemove ()
void TestExists ()
void TestCreateFileInDir ()
void TestMakeDir ()
void TestRemoveDir ()
void TestIsDir ()
void TestRecursivelyMakeDir ()
void TestRecursivelyMakeDir_NoPermission ()
void TestRecursivelyMakeDir_FileInPath ()
void TestListContents ()
void TestAtime ()
void TestMtime ()
void TestDirInfo ()
void TestLock ()
void TestLockTimeout ()

Protected Attributes

GoogleMessageHandler handler_
GoogleString test_tmpdir_

Detailed Description

Base class for testing a FileSystem implementation. Subclasses must implement DeleteRecursively and GetFileSystem, then should create their own tests calling each of our Test* methods.


Member Function Documentation

virtual int net_instaweb::FileSystemTest::DefaultDirSize ( ) const [protected, pure virtual]

Return the size of directories in the file system. This can vary depending on the implementation, since directories in disk-based file systems can consume a disk block.

virtual void net_instaweb::FileSystemTest::DeleteRecursively ( const StringPiece &  filename) [protected, pure virtual]

Delete (at least) the named file or directory and everything underneath it. The test is permitted to delete more things (up to and including the entire file system).

int net_instaweb::FileSystemTest::FileBlockSize ( StringPiece  contents,
int64  default_file_size 
) const [inline, protected]

Calculate on-disk usage of contents by returning size rounded up to nearest default block size.

virtual int net_instaweb::FileSystemTest::FileSize ( StringPiece  contents) const [protected, pure virtual]

Memory based file system implementations of Size return the size of the file, while the APR file system returns the size allocated on disk. This function is overridable to allow AprFileSystemTest and StdioFileSystemTest to calculate the on-disk size of the file.

All FileSystem implementations should run the following tests. Note: If you add a test below, please add invocations in: AprFileSystemTest, StdioFileSystemTest, MemFileSystemTest.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines