OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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. |
| 4 |
| 5 #ifndef CHROME_TEST_LIVE_SYNC_LIVE_EXTENSIONS_SYNC_TEST_BASE_H_ |
| 6 #define CHROME_TEST_LIVE_SYNC_LIVE_EXTENSIONS_SYNC_TEST_BASE_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <map> |
| 10 #include <string> |
| 11 #include <utility> |
| 12 |
| 13 #include "base/basictypes.h" |
| 14 #include "base/compiler_specific.h" |
| 15 #include "base/scoped_temp_dir.h" |
| 16 #include "base/ref_counted.h" |
| 17 #include "chrome/test/live_sync/live_sync_test.h" |
| 18 |
| 19 class Extension; |
| 20 |
| 21 class LiveExtensionsSyncTestBase : public LiveSyncTest { |
| 22 public: |
| 23 virtual ~LiveExtensionsSyncTestBase(); |
| 24 |
| 25 // Like LiveSyncTest::SetupClients(), but also initializes |
| 26 // extensions for each profile. |
| 27 virtual bool SetupClients() WARN_UNUSED_RESULT; |
| 28 |
| 29 protected: |
| 30 // Gets a theme based on the given index. Will always return the |
| 31 // same theme given the same index. |
| 32 scoped_refptr<Extension> GetTheme(int index) WARN_UNUSED_RESULT; |
| 33 |
| 34 // Gets a extension based on the given index. Will always return the |
| 35 // same extension given the same index. |
| 36 scoped_refptr<Extension> GetExtension(int index) WARN_UNUSED_RESULT; |
| 37 |
| 38 // Installs the given extension to the given profile. |
| 39 static void InstallExtension( |
| 40 Profile* profile, scoped_refptr<Extension> extension); |
| 41 |
| 42 // Installs all pending extensions for the given profile. |
| 43 void InstallAllPendingExtensions(Profile* profile); |
| 44 |
| 45 private: |
| 46 friend class LiveThemesSyncTest; |
| 47 friend class LiveExtensionsSyncTest; |
| 48 |
| 49 // Private to avoid inadvertent instantiation except through |
| 50 // approved subclasses (above). |
| 51 explicit LiveExtensionsSyncTestBase(TestType test_type); |
| 52 |
| 53 // Returns an extension of the given type and index. Will always |
| 54 // return the same extension given the same type and index. |
| 55 scoped_refptr<Extension> GetExtensionHelper( |
| 56 bool is_theme, int index) WARN_UNUSED_RESULT; |
| 57 |
| 58 typedef std::map<std::pair<bool, int>, scoped_refptr<Extension> > |
| 59 ExtensionTypeIndexMap; |
| 60 typedef std::map<std::string, scoped_refptr<Extension> > ExtensionIdMap; |
| 61 |
| 62 ScopedTempDir extension_base_dir_; |
| 63 ExtensionTypeIndexMap extensions_by_type_index_; |
| 64 ExtensionIdMap extensions_by_id_; |
| 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(LiveExtensionsSyncTestBase); |
| 67 }; |
| 68 |
| 69 #endif // CHROME_TEST_LIVE_SYNC_LIVE_EXTENSIONS_SYNC_TEST_BASE_H_ |
OLD | NEW |