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 ResourceBundle::GetSharedInstance().GetRawDataResource(*iter) | 795 scoped_refptr<base::RefCountedMemory> resource = |
796 .AppendToString(&script); | 796 ResourceBundle::GetSharedInstance().LoadDataResourceBytes(*iter); |
| 797 script.append(resource->front_as<char>(), resource->size()); |
797 script.append("\n"); | 798 script.append("\n"); |
798 } | 799 } |
799 if (!ExecuteScript(web_contents, script)) | 800 if (!ExecuteScript(web_contents, script)) |
800 return false; | 801 return false; |
801 | 802 |
802 DOMMessageQueue message_queue; | 803 DOMMessageQueue message_queue; |
803 if (!ExecuteScript(web_contents, "runTests()")) | 804 if (!ExecuteScript(web_contents, "runTests()")) |
804 return false; | 805 return false; |
805 | 806 |
806 std::string message; | 807 std::string message; |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1256 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
1256 if (ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN) | 1257 if (ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN) |
1257 return ack_result_; | 1258 return ack_result_; |
1258 base::RunLoop run_loop; | 1259 base::RunLoop run_loop; |
1259 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure()); | 1260 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure()); |
1260 run_loop.Run(); | 1261 run_loop.Run(); |
1261 return ack_result_; | 1262 return ack_result_; |
1262 } | 1263 } |
1263 | 1264 |
1264 } // namespace content | 1265 } // namespace content |
OLD | NEW |