| 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" |
| 11 #include "chrome/common/render_messages.h" | 11 #include "chrome/common/render_messages.h" |
| 12 #include "chrome/test/base/ui_test_utils.h" | 12 #include "chrome/test/base/ui_test_utils.h" |
| 13 #include "content/public/browser/notification_details.h" | 13 #include "content/public/browser/notification_details.h" |
| 14 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
| 15 #include "content/public/browser/notification_types.h" | 15 #include "content/public/browser/notification_types.h" |
| 16 #include "content/public/browser/render_view_host.h" | 16 #include "content/public/browser/render_view_host.h" |
| 17 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| 18 #include "content/public/browser/web_ui.h" | 18 #include "content/public/browser/web_ui.h" |
| 19 | 19 |
| 20 using content::RenderViewHost; |
| 21 |
| 20 WebUITestHandler::WebUITestHandler() | 22 WebUITestHandler::WebUITestHandler() |
| 21 : test_done_(false), | 23 : test_done_(false), |
| 22 test_succeeded_(false), | 24 test_succeeded_(false), |
| 23 run_test_done_(false), | 25 run_test_done_(false), |
| 24 run_test_succeeded_(false), | 26 run_test_succeeded_(false), |
| 25 is_waiting_(false) { | 27 is_waiting_(false) { |
| 26 } | 28 } |
| 27 | 29 |
| 28 void WebUITestHandler::PreloadJavaScript(const string16& js_text, | 30 void WebUITestHandler::PreloadJavaScript(const string16& js_text, |
| 29 RenderViewHost* preload_host) { | 31 RenderViewHost* preload_host) { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // complete. | 112 // complete. |
| 111 if (!run_test_done_ || (run_test_succeeded_ && !test_done_)) { | 113 if (!run_test_done_ || (run_test_succeeded_ && !test_done_)) { |
| 112 ui_test_utils::RunMessageLoop(); | 114 ui_test_utils::RunMessageLoop(); |
| 113 } | 115 } |
| 114 | 116 |
| 115 is_waiting_ = false; | 117 is_waiting_ = false; |
| 116 | 118 |
| 117 // 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. |
| 118 return run_test_succeeded_ && test_succeeded_; | 120 return run_test_succeeded_ && test_succeeded_; |
| 119 } | 121 } |
| OLD | NEW |