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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 EXPECT_FALSE(test_done_); | 68 EXPECT_FALSE(test_done_); |
69 test_done_ = true; | 69 test_done_ = true; |
70 test_succeeded_ = false; | 70 test_succeeded_ = false; |
71 | 71 |
72 ASSERT_TRUE(test_result->GetBoolean(0, &test_succeeded_)); | 72 ASSERT_TRUE(test_result->GetBoolean(0, &test_succeeded_)); |
73 if (!test_succeeded_) { | 73 if (!test_succeeded_) { |
74 std::string message; | 74 std::string message; |
75 ASSERT_TRUE(test_result->GetString(1, &message)); | 75 ASSERT_TRUE(test_result->GetString(1, &message)); |
76 LOG(ERROR) << message; | 76 LOG(ERROR) << message; |
77 } | 77 } |
78 | |
79 if (test_result->GetSize() > 2) { | |
Sheridan Rawlins
2012/12/18 01:43:35
This won't be needed if you do the console.warn st
| |
80 std::string a11y_message; | |
81 ASSERT_TRUE(test_result->GetString(2, &a11y_message)); | |
82 LOG(ERROR) << a11y_message; | |
83 } else { | |
84 LOG(ERROR) << "a11y passed"; | |
85 } | |
78 } | 86 } |
79 | 87 |
80 void WebUITestHandler::Observe(int type, | 88 void WebUITestHandler::Observe(int type, |
81 const content::NotificationSource& source, | 89 const content::NotificationSource& source, |
82 const content::NotificationDetails& details) { | 90 const content::NotificationDetails& details) { |
83 // Quit the message loop if |is_waiting_| so waiting process can get result or | 91 // Quit the message loop if |is_waiting_| so waiting process can get result or |
84 // error. To ensure this gets done, do this before ASSERT* calls. | 92 // error. To ensure this gets done, do this before ASSERT* calls. |
85 if (is_waiting_) | 93 if (is_waiting_) |
86 MessageLoopForUI::current()->Quit(); | 94 MessageLoopForUI::current()->Quit(); |
87 | 95 |
(...skipping 24 matching lines...) Expand all Loading... | |
112 // complete. | 120 // complete. |
113 if (!run_test_done_ || (run_test_succeeded_ && !test_done_)) { | 121 if (!run_test_done_ || (run_test_succeeded_ && !test_done_)) { |
114 content::RunMessageLoop(); | 122 content::RunMessageLoop(); |
115 } | 123 } |
116 | 124 |
117 is_waiting_ = false; | 125 is_waiting_ = false; |
118 | 126 |
119 // To succeed the test must execute as well as pass the test. | 127 // To succeed the test must execute as well as pass the test. |
120 return run_test_succeeded_ && test_succeeded_; | 128 return run_test_succeeded_ && test_succeeded_; |
121 } | 129 } |
OLD | NEW |