| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/login/mixin_based_browser_test.h" | 5 #include "chrome/browser/chromeos/login/mixin_based_browser_test.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/containers/adapters.h" | 9 #include "base/containers/adapters.h" |
| 10 | 10 |
| 11 namespace chromeos { | 11 namespace chromeos { |
| 12 | 12 |
| 13 MixinBasedBrowserTest::MixinBasedBrowserTest() : setup_was_launched_(false) { | 13 MixinBasedBrowserTest::MixinBasedBrowserTest() : setup_was_launched_(false) { |
| 14 } | 14 } |
| 15 | 15 |
| 16 MixinBasedBrowserTest::~MixinBasedBrowserTest() { | 16 MixinBasedBrowserTest::~MixinBasedBrowserTest() { |
| 17 } | 17 } |
| 18 | 18 |
| 19 void MixinBasedBrowserTest::SetUpCommandLine(base::CommandLine* command_line) { | 19 void MixinBasedBrowserTest::SetUpCommandLine(base::CommandLine* command_line) { |
| 20 setup_was_launched_ = true; | 20 setup_was_launched_ = true; |
| 21 for (const auto& mixin : mixins_) | 21 for (const auto& mixin : mixins_) |
| 22 mixin->SetUpCommandLine(command_line); | 22 mixin->SetUpCommandLine(command_line); |
| 23 | |
| 24 InProcessBrowserTest::SetUpCommandLine(command_line); | |
| 25 } | 23 } |
| 26 | 24 |
| 27 void MixinBasedBrowserTest::SetUpInProcessBrowserTestFixture() { | 25 void MixinBasedBrowserTest::SetUpInProcessBrowserTestFixture() { |
| 28 setup_was_launched_ = true; | 26 setup_was_launched_ = true; |
| 29 for (const auto& mixin : mixins_) | 27 for (const auto& mixin : mixins_) |
| 30 mixin->SetUpInProcessBrowserTestFixture(); | 28 mixin->SetUpInProcessBrowserTestFixture(); |
| 31 | |
| 32 InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); | |
| 33 } | 29 } |
| 34 | 30 |
| 35 void MixinBasedBrowserTest::SetUpOnMainThread() { | 31 void MixinBasedBrowserTest::SetUpOnMainThread() { |
| 36 setup_was_launched_ = true; | 32 setup_was_launched_ = true; |
| 37 for (const auto& mixin : mixins_) | 33 for (const auto& mixin : mixins_) |
| 38 mixin->SetUpOnMainThread(); | 34 mixin->SetUpOnMainThread(); |
| 39 } | 35 } |
| 40 | 36 |
| 41 void MixinBasedBrowserTest::TearDownOnMainThread() { | 37 void MixinBasedBrowserTest::TearDownOnMainThread() { |
| 42 InProcessBrowserTest::TearDownOnMainThread(); | |
| 43 for (const auto& mixin : base::Reversed(mixins_)) | 38 for (const auto& mixin : base::Reversed(mixins_)) |
| 44 mixin->TearDownInProcessBrowserTestFixture(); | 39 mixin->TearDownInProcessBrowserTestFixture(); |
| 45 } | 40 } |
| 41 |
| 46 void MixinBasedBrowserTest::TearDownInProcessBrowserTestFixture() { | 42 void MixinBasedBrowserTest::TearDownInProcessBrowserTestFixture() { |
| 47 InProcessBrowserTest::TearDownInProcessBrowserTestFixture(); | |
| 48 for (const auto& mixin : base::Reversed(mixins_)) | 43 for (const auto& mixin : base::Reversed(mixins_)) |
| 49 mixin->TearDownInProcessBrowserTestFixture(); | 44 mixin->TearDownInProcessBrowserTestFixture(); |
| 50 } | 45 } |
| 51 | 46 |
| 52 void MixinBasedBrowserTest::AddMixin(std::unique_ptr<Mixin> mixin) { | 47 void MixinBasedBrowserTest::AddMixin(std::unique_ptr<Mixin> mixin) { |
| 53 CHECK(!setup_was_launched_) | 48 CHECK(!setup_was_launched_) |
| 54 << "You are trying to add a mixin after setting up has already started."; | 49 << "You are trying to add a mixin after setting up has already started."; |
| 55 mixins_.push_back(std::move(mixin)); | 50 mixins_.push_back(std::move(mixin)); |
| 56 } | 51 } |
| 57 | 52 |
| 58 } // namespace chromeos | 53 } // namespace chromeos |
| OLD | NEW |