| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/test/ash_test_base.h" | 5 #include "ash/test/ash_test_base.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 #if defined(OS_WIN) | 41 #if defined(OS_WIN) |
| 42 #include "ash/test/test_metro_viewer_process_host.h" | 42 #include "ash/test/test_metro_viewer_process_host.h" |
| 43 #include "base/test/test_process_killer_win.h" | 43 #include "base/test/test_process_killer_win.h" |
| 44 #include "base/win/metro.h" | 44 #include "base/win/metro.h" |
| 45 #include "base/win/windows_version.h" | 45 #include "base/win/windows_version.h" |
| 46 #include "ui/aura/remote_window_tree_host_win.h" | 46 #include "ui/aura/remote_window_tree_host_win.h" |
| 47 #include "ui/aura/window_tree_host_win.h" | 47 #include "ui/aura/window_tree_host_win.h" |
| 48 #include "win8/test/test_registrar_constants.h" | 48 #include "win8/test/test_registrar_constants.h" |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 #if defined(USE_X11) |
| 52 #include <X11/Xlib.h> |
| 53 #endif |
| 54 |
| 51 namespace ash { | 55 namespace ash { |
| 52 namespace test { | 56 namespace test { |
| 53 namespace { | 57 namespace { |
| 54 | 58 |
| 55 class AshEventGeneratorDelegate : public aura::test::EventGeneratorDelegate { | 59 class AshEventGeneratorDelegate : public aura::test::EventGeneratorDelegate { |
| 56 public: | 60 public: |
| 57 AshEventGeneratorDelegate() {} | 61 AshEventGeneratorDelegate() {} |
| 58 virtual ~AshEventGeneratorDelegate() {} | 62 virtual ~AshEventGeneratorDelegate() {} |
| 59 | 63 |
| 60 // aura::test::EventGeneratorDelegate overrides: | 64 // aura::test::EventGeneratorDelegate overrides: |
| (...skipping 22 matching lines...) Expand all Loading... |
| 83 return content::WebContentsTester::CreateTestWebContents(browser_context, | 87 return content::WebContentsTester::CreateTestWebContents(browser_context, |
| 84 site_instance); | 88 site_instance); |
| 85 } | 89 } |
| 86 | 90 |
| 87 ///////////////////////////////////////////////////////////////////////////// | 91 ///////////////////////////////////////////////////////////////////////////// |
| 88 | 92 |
| 89 AshTestBase::AshTestBase() | 93 AshTestBase::AshTestBase() |
| 90 : setup_called_(false), | 94 : setup_called_(false), |
| 91 teardown_called_(false), | 95 teardown_called_(false), |
| 92 start_session_(true) { | 96 start_session_(true) { |
| 97 #if defined(USE_X11) |
| 98 // This is needed for tests which use this base class but are run in browser |
| 99 // test binaries so don't get the default initialization in the unit test |
| 100 // suite. |
| 101 XInitThreads(); |
| 102 #endif |
| 103 |
| 104 thread_bundle_.reset(new content::TestBrowserThreadBundle); |
| 93 // Must initialize |ash_test_helper_| here because some tests rely on | 105 // Must initialize |ash_test_helper_| here because some tests rely on |
| 94 // AshTestBase methods before they call AshTestBase::SetUp(). | 106 // AshTestBase methods before they call AshTestBase::SetUp(). |
| 95 ash_test_helper_.reset(new AshTestHelper(base::MessageLoopForUI::current())); | 107 ash_test_helper_.reset(new AshTestHelper(base::MessageLoopForUI::current())); |
| 96 } | 108 } |
| 97 | 109 |
| 98 AshTestBase::~AshTestBase() { | 110 AshTestBase::~AshTestBase() { |
| 99 CHECK(setup_called_) | 111 CHECK(setup_called_) |
| 100 << "You have overridden SetUp but never called AshTestBase::SetUp"; | 112 << "You have overridden SetUp but never called AshTestBase::SetUp"; |
| 101 CHECK(teardown_called_) | 113 CHECK(teardown_called_) |
| 102 << "You have overridden TearDown but never called AshTestBase::TearDown"; | 114 << "You have overridden TearDown but never called AshTestBase::TearDown"; |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 | 352 |
| 341 void AshTestBase::UnblockUserSession() { | 353 void AshTestBase::UnblockUserSession() { |
| 342 Shell::GetInstance()->session_state_delegate()->UnlockScreen(); | 354 Shell::GetInstance()->session_state_delegate()->UnlockScreen(); |
| 343 SetSessionStarted(true); | 355 SetSessionStarted(true); |
| 344 SetUserAddingScreenRunning(false); | 356 SetUserAddingScreenRunning(false); |
| 345 } | 357 } |
| 346 | 358 |
| 347 | 359 |
| 348 } // namespace test | 360 } // namespace test |
| 349 } // namespace ash | 361 } // namespace ash |
| OLD | NEW |