1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_MANAGER_BROWSERTEST_BASE_H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_MANAGER_BROWSERTEST_BASE_H_
11 #include "base/values.h"
12 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
13 #include "chrome/browser/extensions/extension_apitest.h"
14 #include "chrome/browser/profiles/profile.h"
16 // Slow tests are disabled on debug build. http://crbug.com/327719
17 // Disabled under MSAN, ASAN, and LSAN as well. http://crbug.com/468980.
18 #if !defined(NDEBUG) || defined(MEMORY_SANITIZER) || \
19 defined(ADDRESS_SANITIZER) || defined(LEAK_SANITIZER)
20 #define DISABLE_SLOW_FILESAPP_TESTS
23 namespace file_manager
{
25 enum GuestMode
{ NOT_IN_GUEST_MODE
, IN_GUEST_MODE
, IN_INCOGNITO
};
27 class LocalTestVolume
;
28 class DriveTestVolume
;
31 // The base test class.
32 class FileManagerBrowserTestBase
: public ExtensionApiTest
{
34 FileManagerBrowserTestBase();
35 ~FileManagerBrowserTestBase() override
;
37 void SetUpInProcessBrowserTestFixture() override
;
39 void SetUpOnMainThread() override
;
41 // Adds an incognito and guest-mode flags for tests in the guest mode.
42 void SetUpCommandLine(base::CommandLine
* command_line
) override
;
44 // Installs an extension at the specified |path| using the |manifest_name|
46 void InstallExtension(const base::FilePath
& path
, const char* manifest_name
);
47 // Loads our testing extension and sends it a string identifying the current
49 virtual void StartTest();
50 void RunTestMessageLoop();
52 // Overriding point for test configurations.
53 virtual const char* GetTestManifestName() const = 0;
54 virtual GuestMode
GetGuestModeParam() const = 0;
55 virtual const char* GetTestCaseNameParam() const = 0;
56 virtual void OnMessage(const std::string
& name
,
57 const base::DictionaryValue
& value
,
60 scoped_ptr
<LocalTestVolume
> local_volume_
;
61 linked_ptr
<DriveTestVolume
> drive_volume_
;
62 std::map
<Profile
*, linked_ptr
<DriveTestVolume
>> drive_volumes_
;
63 scoped_ptr
<FakeTestVolume
> usb_volume_
;
64 scoped_ptr
<FakeTestVolume
> mtp_volume_
;
67 drive::DriveIntegrationService
* CreateDriveIntegrationService(
69 drive::DriveIntegrationServiceFactory::FactoryCallback
70 create_drive_integration_service_
;
71 scoped_ptr
<drive::DriveIntegrationServiceFactory::ScopedFactoryForTest
>
72 service_factory_for_test_
;
75 } // namespace file_manager
77 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_MANAGER_BROWSERTEST_BASE_H_