Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2014 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_BROWSER_CHROMEOS_LOGIN_MIXIN_IN_PROCESS_BROWSER_TEST_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_MIXIN_IN_PROCESS_BROWSER_TEST_H_ | |
| 7 | |
| 8 #include "base/memory/scoped_vector.h" | |
| 9 #include "chrome/test/base/in_process_browser_test.h" | |
| 10 | |
| 11 namespace chromeos { | |
| 12 | |
| 13 class MixinInProcessBrowserTest : public InProcessBrowserTest { | |
|
Denis Kuznetsov (DE-MUC)
2014/09/16 14:08:34
I would think on better name - no need to include
Lisa Ignatyeva
2014/09/17 10:39:37
Done.
| |
| 14 public: | |
| 15 // Class that can be used to add some features not related directly | |
| 16 // to the testing process and do set ups needed for them in proper time. | |
| 17 // To do this you need to derive Mixin, implement | |
| 18 // all the methods you need there and (if needed) reload set ups and tear | |
| 19 // downs | |
| 20 // for things that you would usually do in those of the test, but which are | |
| 21 // connected | |
| 22 // to the mixin, not to the test itself. | |
| 23 // Finally, AddMixin() should be called in the test's constructor for each | |
| 24 // mixin. | |
| 25 class Mixin { | |
| 26 public: | |
| 27 Mixin() {} | |
| 28 virtual ~Mixin() {} | |
| 29 virtual void SetUpCommandLine(base::CommandLine* command_line) {} | |
| 30 virtual void SetUpOnMainThread() {} | |
| 31 virtual void SetUpInProcessBrowserTestFixture() {} | |
|
Denis Kuznetsov (DE-MUC)
2014/09/16 14:08:34
Some comments for these methods (maybe copied from
Lisa Ignatyeva
2014/09/17 10:39:37
Done.
| |
| 32 virtual void TearDownOnMainThread() {} | |
| 33 virtual void TearDownInProcessBrowserTestFixture() {} | |
| 34 }; | |
| 35 | |
| 36 MixinInProcessBrowserTest(); | |
| 37 virtual ~MixinInProcessBrowserTest(); | |
| 38 virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; | |
| 39 virtual void SetUpOnMainThread() OVERRIDE; | |
| 40 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; | |
| 41 virtual void TearDownOnMainThread() OVERRIDE; | |
| 42 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE; | |
| 43 | |
| 44 protected: | |
| 45 // Adds |mixin| as an mixin for this test, passing ownership | |
| 46 // for it to MixinInProcessBrowserTest. | |
| 47 // Should be called in constructor of the test (should be already completed | |
| 48 // before running set ups). | |
| 49 void AddMixin(Mixin* mixin); | |
| 50 | |
| 51 private: | |
| 52 // Keeps all the mixins for this test, | |
| 53 ScopedVector<Mixin> mixins_; | |
| 54 }; | |
| 55 | |
| 56 } // namespace chromeos | |
| 57 | |
| 58 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MIXIN_IN_PROCESS_BROWSER_TEST_H_ | |
| OLD | NEW |