| 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 "content/public/test/browser_test_utils.h" | 5 #include "content/public/test/browser_test_utils.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 // Inject WebUI test runner script first prior to other scripts required to | 785 // Inject WebUI test runner script first prior to other scripts required to |
| 786 // run the test as scripts may depend on it being declared. | 786 // run the test as scripts may depend on it being declared. |
| 787 std::vector<int> ids; | 787 std::vector<int> ids; |
| 788 ids.push_back(IDR_WEBUI_JS_WEBUI_RESOURCE_TEST); | 788 ids.push_back(IDR_WEBUI_JS_WEBUI_RESOURCE_TEST); |
| 789 ids.insert(ids.end(), js_resource_ids.begin(), js_resource_ids.end()); | 789 ids.insert(ids.end(), js_resource_ids.begin(), js_resource_ids.end()); |
| 790 | 790 |
| 791 std::string script; | 791 std::string script; |
| 792 for (std::vector<int>::iterator iter = ids.begin(); | 792 for (std::vector<int>::iterator iter = ids.begin(); |
| 793 iter != ids.end(); | 793 iter != ids.end(); |
| 794 ++iter) { | 794 ++iter) { |
| 795 scoped_refptr<base::RefCountedMemory> resource = | 795 ResourceBundle::GetSharedInstance().GetRawDataResource(*iter) |
| 796 ResourceBundle::GetSharedInstance().LoadDataResourceBytes(*iter); | 796 .AppendToString(&script); |
| 797 script.append(resource->front_as<char>(), resource->size()); | |
| 798 script.append("\n"); | 797 script.append("\n"); |
| 799 } | 798 } |
| 800 if (!ExecuteScript(web_contents, script)) | 799 if (!ExecuteScript(web_contents, script)) |
| 801 return false; | 800 return false; |
| 802 | 801 |
| 803 DOMMessageQueue message_queue; | 802 DOMMessageQueue message_queue; |
| 804 if (!ExecuteScript(web_contents, "runTests()")) | 803 if (!ExecuteScript(web_contents, "runTests()")) |
| 805 return false; | 804 return false; |
| 806 | 805 |
| 807 std::string message; | 806 std::string message; |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1258 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1257 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1259 if (ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN) | 1258 if (ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN) |
| 1260 return ack_result_; | 1259 return ack_result_; |
| 1261 base::RunLoop run_loop; | 1260 base::RunLoop run_loop; |
| 1262 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure()); | 1261 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure()); |
| 1263 run_loop.Run(); | 1262 run_loop.Run(); |
| 1264 return ack_result_; | 1263 return ack_result_; |
| 1265 } | 1264 } |
| 1266 | 1265 |
| 1267 } // namespace content | 1266 } // namespace content |
| OLD | NEW |