Page Speed Optimization Libraries
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Protected Member Functions | Protected Attributes | List of all members
net_instaweb::FileSystemTest Class Referenceabstract

#include "file_system_test_base.h"

Inheritance diagram for net_instaweb::FileSystemTest:

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 ()
void TestLockBumping ()

Protected Attributes

GoogleMessageHandler handler_
GoogleString test_tmpdir_

Detailed Description

TODO(huibao): Rename FileSystemTest to FileSystemTestBase.

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
protectedpure 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)
protectedpure 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

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
protectedpure 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.

void net_instaweb::FileSystemTest::TestWriteRead ( )

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: