| 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 162     const std::string& script) { | 162     const std::string& script) { | 
| 163   EvaluateHelper helper(this, web_contents, script); | 163   EvaluateHelper helper(this, web_contents, script); | 
| 164   RunAsynchronousTest(); | 164   RunAsynchronousTest(); | 
| 165   return helper.TakeResult(); | 165   return helper.TakeResult(); | 
| 166 } | 166 } | 
| 167 | 167 | 
| 168 void HeadlessBrowserTest::RunAsynchronousTest() { | 168 void HeadlessBrowserTest::RunAsynchronousTest() { | 
| 169   base::MessageLoop::ScopedNestableTaskAllower nestable_allower( | 169   base::MessageLoop::ScopedNestableTaskAllower nestable_allower( | 
| 170       base::MessageLoop::current()); | 170       base::MessageLoop::current()); | 
| 171   EXPECT_FALSE(run_loop_); | 171   EXPECT_FALSE(run_loop_); | 
| 172   run_loop_ = base::WrapUnique(new base::RunLoop()); | 172   run_loop_ = base::MakeUnique<base::RunLoop>(); | 
| 173   run_loop_->Run(); | 173   run_loop_->Run(); | 
| 174   run_loop_ = nullptr; | 174   run_loop_ = nullptr; | 
| 175 } | 175 } | 
| 176 | 176 | 
| 177 void HeadlessBrowserTest::FinishAsynchronousTest() { | 177 void HeadlessBrowserTest::FinishAsynchronousTest() { | 
| 178   run_loop_->Quit(); | 178   run_loop_->Quit(); | 
| 179 } | 179 } | 
| 180 | 180 | 
| 181 HeadlessAsyncDevTooledBrowserTest::HeadlessAsyncDevTooledBrowserTest() | 181 HeadlessAsyncDevTooledBrowserTest::HeadlessAsyncDevTooledBrowserTest() | 
| 182     : web_contents_(nullptr), | 182     : web_contents_(nullptr), | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
| 200 | 200 | 
| 201   web_contents_->GetDevToolsTarget()->DetachClient(devtools_client_.get()); | 201   web_contents_->GetDevToolsTarget()->DetachClient(devtools_client_.get()); | 
| 202   web_contents_->RemoveObserver(this); | 202   web_contents_->RemoveObserver(this); | 
| 203   web_contents_->Close(); | 203   web_contents_->Close(); | 
| 204   web_contents_ = nullptr; | 204   web_contents_ = nullptr; | 
| 205   browser_context_->Close(); | 205   browser_context_->Close(); | 
| 206   browser_context_ = nullptr; | 206   browser_context_ = nullptr; | 
| 207 } | 207 } | 
| 208 | 208 | 
| 209 }  // namespace headless | 209 }  // namespace headless | 
| OLD | NEW | 
|---|