| 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 "base/test/test_listener_ios.h" | 5 #include "base/test/test_listener_ios.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 | 8 |
| 9 #include "base/mac/scoped_nsautorelease_pool.h" | 9 #include "base/mac/scoped_nsautorelease_pool.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/googletest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 // The iOS watchdog timer will kill an app that doesn't spin the main event | 12 // The iOS watchdog timer will kill an app that doesn't spin the main event |
| 13 // loop often enough. This uses a Gtest TestEventListener to spin the current | 13 // loop often enough. This uses a Gtest TestEventListener to spin the current |
| 14 // loop after each test finishes. However, if any individual test takes too | 14 // loop after each test finishes. However, if any individual test takes too |
| 15 // long, it is still possible that the app will get killed. | 15 // long, it is still possible that the app will get killed. |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 class IOSRunLoopListener : public testing::EmptyTestEventListener { | 19 class IOSRunLoopListener : public testing::EmptyTestEventListener { |
| 20 public: | 20 public: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 36 namespace test_listener_ios { | 36 namespace test_listener_ios { |
| 37 | 37 |
| 38 void RegisterTestEndListener() { | 38 void RegisterTestEndListener() { |
| 39 testing::TestEventListeners& listeners = | 39 testing::TestEventListeners& listeners = |
| 40 testing::UnitTest::GetInstance()->listeners(); | 40 testing::UnitTest::GetInstance()->listeners(); |
| 41 listeners.Append(new IOSRunLoopListener); | 41 listeners.Append(new IOSRunLoopListener); |
| 42 } | 42 } |
| 43 | 43 |
| 44 } // namespace test_listener_ios | 44 } // namespace test_listener_ios |
| 45 } // namespace base | 45 } // namespace base |
| OLD | NEW |