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 "chrome/browser/ui/webui/web_ui_test_handler.h" | 5 #include "chrome/browser/ui/webui/web_ui_test_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 98 } |
99 | 99 |
100 bool WebUITestHandler::WaitForResult() { | 100 bool WebUITestHandler::WaitForResult() { |
101 SCOPED_TRACE("WebUITestHandler::WaitForResult"); | 101 SCOPED_TRACE("WebUITestHandler::WaitForResult"); |
102 test_done_ = false; | 102 test_done_ = false; |
103 run_test_done_ = false; | 103 run_test_done_ = false; |
104 is_waiting_ = true; | 104 is_waiting_ = true; |
105 | 105 |
106 // Either sync test completion or the testDone() will cause message loop | 106 // Either sync test completion or the testDone() will cause message loop |
107 // to quit. | 107 // to quit. |
108 ui_test_utils::RunMessageLoop(); | 108 content::RunMessageLoop(); |
109 | 109 |
110 // Run a second message loop when not |run_test_done_| so that the sync test | 110 // Run a second message loop when not |run_test_done_| so that the sync test |
111 // completes, or |run_test_succeeded_| but not |test_done_| so async tests | 111 // completes, or |run_test_succeeded_| but not |test_done_| so async tests |
112 // complete. | 112 // complete. |
113 if (!run_test_done_ || (run_test_succeeded_ && !test_done_)) { | 113 if (!run_test_done_ || (run_test_succeeded_ && !test_done_)) { |
114 ui_test_utils::RunMessageLoop(); | 114 content::RunMessageLoop(); |
115 } | 115 } |
116 | 116 |
117 is_waiting_ = false; | 117 is_waiting_ = false; |
118 | 118 |
119 // To succeed the test must execute as well as pass the test. | 119 // To succeed the test must execute as well as pass the test. |
120 return run_test_succeeded_ && test_succeeded_; | 120 return run_test_succeeded_ && test_succeeded_; |
121 } | 121 } |
OLD | NEW |