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.
5 #include "chrome/browser/chromeos/login/mixin_based_browser_test.h"
9 MixinBasedBrowserTest::MixinBasedBrowserTest() : setup_was_launched_(false) {
12 MixinBasedBrowserTest::~MixinBasedBrowserTest() {
15 void MixinBasedBrowserTest::SetUpCommandLine(base::CommandLine
* command_line
) {
16 setup_was_launched_
= true;
17 for (ScopedVector
<Mixin
>::iterator it
= mixins_
.begin(); it
!= mixins_
.end();
19 (*it
)->SetUpCommandLine(command_line
);
21 InProcessBrowserTest::SetUpCommandLine(command_line
);
24 void MixinBasedBrowserTest::SetUpInProcessBrowserTestFixture() {
25 setup_was_launched_
= true;
26 for (ScopedVector
<Mixin
>::iterator it
= mixins_
.begin(); it
!= mixins_
.end();
28 (*it
)->SetUpInProcessBrowserTestFixture();
30 InProcessBrowserTest::SetUpInProcessBrowserTestFixture();
33 void MixinBasedBrowserTest::SetUpOnMainThread() {
34 setup_was_launched_
= true;
35 for (ScopedVector
<Mixin
>::iterator it
= mixins_
.begin(); it
!= mixins_
.end();
37 (*it
)->SetUpOnMainThread();
39 InProcessBrowserTest::SetUpOnMainThread();
42 void MixinBasedBrowserTest::TearDownOnMainThread() {
43 InProcessBrowserTest::TearDownOnMainThread();
44 for (ScopedVector
<Mixin
>::reverse_iterator it
= mixins_
.rbegin();
47 (*it
)->TearDownInProcessBrowserTestFixture();
50 void MixinBasedBrowserTest::TearDownInProcessBrowserTestFixture() {
51 InProcessBrowserTest::TearDownInProcessBrowserTestFixture();
52 for (ScopedVector
<Mixin
>::reverse_iterator it
= mixins_
.rbegin();
55 (*it
)->TearDownInProcessBrowserTestFixture();
59 void MixinBasedBrowserTest::AddMixin(MixinBasedBrowserTest::Mixin
* mixin
) {
60 CHECK(!setup_was_launched_
)
61 << "You are trying to add a mixin after setting up has already started.";
62 mixins_
.push_back(mixin
);
65 } // namespace chromeos