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 SetUp() override
;
39 void SetUpInProcessBrowserTestFixture() override
;
41 void SetUpOnMainThread() override
;
43 // Adds an incognito and guest-mode flags for tests in the guest mode.
44 void SetUpCommandLine(base::CommandLine
* command_line
) override
;
46 // Installs an extension at the specified |path| using the |manifest_name|
48 void InstallExtension(const base::FilePath
& path
, const char* manifest_name
);
49 // Loads our testing extension and sends it a string identifying the current
51 virtual void StartTest();
52 void RunTestMessageLoop();
54 // Overriding point for test configurations.
55 virtual const char* GetTestManifestName() const = 0;
56 virtual GuestMode
GetGuestModeParam() const = 0;
57 virtual const char* GetTestCaseNameParam() const = 0;
58 virtual void OnMessage(const std::string
& name
,
59 const base::DictionaryValue
& value
,
62 scoped_ptr
<LocalTestVolume
> local_volume_
;
63 linked_ptr
<DriveTestVolume
> drive_volume_
;
64 std::map
<Profile
*, linked_ptr
<DriveTestVolume
>> drive_volumes_
;
65 scoped_ptr
<FakeTestVolume
> usb_volume_
;
66 scoped_ptr
<FakeTestVolume
> mtp_volume_
;
69 drive::DriveIntegrationService
* CreateDriveIntegrationService(
71 drive::DriveIntegrationServiceFactory::FactoryCallback
72 create_drive_integration_service_
;
73 scoped_ptr
<drive::DriveIntegrationServiceFactory::ScopedFactoryForTest
>
74 service_factory_for_test_
;
77 } // namespace file_manager
79 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_MANAGER_BROWSERTEST_BASE_H_