| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "headless/test/headless_browser_test.h" | 5 #include "headless/test/headless_browser_test.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 bool HeadlessBrowserTest::WaitForLoad(HeadlessWebContents* web_contents) { | 92 bool HeadlessBrowserTest::WaitForLoad(HeadlessWebContents* web_contents) { |
| 93 WaitForNavigationObserver observer(this, web_contents); | 93 WaitForNavigationObserver observer(this, web_contents); |
| 94 RunAsynchronousTest(); | 94 RunAsynchronousTest(); |
| 95 return observer.navigation_succeeded(); | 95 return observer.navigation_succeeded(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void HeadlessBrowserTest::RunAsynchronousTest() { | 98 void HeadlessBrowserTest::RunAsynchronousTest() { |
| 99 base::MessageLoop::ScopedNestableTaskAllower nestable_allower( | 99 base::MessageLoop::ScopedNestableTaskAllower nestable_allower( |
| 100 base::MessageLoop::current()); | 100 base::MessageLoop::current()); |
| 101 EXPECT_FALSE(run_loop_); |
| 101 run_loop_ = base::WrapUnique(new base::RunLoop()); | 102 run_loop_ = base::WrapUnique(new base::RunLoop()); |
| 102 run_loop_->Run(); | 103 run_loop_->Run(); |
| 103 run_loop_ = nullptr; | 104 run_loop_ = nullptr; |
| 104 } | 105 } |
| 105 | 106 |
| 106 void HeadlessBrowserTest::FinishAsynchronousTest() { | 107 void HeadlessBrowserTest::FinishAsynchronousTest() { |
| 107 run_loop_->Quit(); | 108 run_loop_->Quit(); |
| 108 } | 109 } |
| 109 | 110 |
| 110 } // namespace headless | 111 } // namespace headless |
| OLD | NEW |