| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 // Remove the query string if present. | 603 // Remove the query string if present. |
| 604 std::string request_query; | 604 std::string request_query; |
| 605 size_t query_pos = request_path.find('?'); | 605 size_t query_pos = request_path.find('?'); |
| 606 if (query_pos != std::string::npos) { | 606 if (query_pos != std::string::npos) { |
| 607 request_query = request_path.substr(query_pos + 1); | 607 request_query = request_path.substr(query_pos + 1); |
| 608 request_path = request_path.substr(0, query_pos); | 608 request_path = request_path.substr(0, query_pos); |
| 609 } | 609 } |
| 610 | 610 |
| 611 if (request_path == "corruptdb" && !request_query.empty()) { | 611 if (request_path == "corruptdb" && !request_query.empty()) { |
| 612 VLOG(0) << "Requested to corrupt IndexedDB: " << request_query; | 612 VLOG(0) << "Requested to corrupt IndexedDB: " << request_query; |
| 613 base::WaitableEvent signal_when_finished(false, false); | 613 base::WaitableEvent signal_when_finished( |
| 614 base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 615 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 614 context->TaskRunner()->PostTask( | 616 context->TaskRunner()->PostTask( |
| 615 FROM_HERE, | 617 FROM_HERE, |
| 616 base::Bind(&CorruptIndexedDBDatabase, base::ConstRef(context), origin, | 618 base::Bind(&CorruptIndexedDBDatabase, base::ConstRef(context), origin, |
| 617 &signal_when_finished)); | 619 &signal_when_finished)); |
| 618 signal_when_finished.Wait(); | 620 signal_when_finished.Wait(); |
| 619 | 621 |
| 620 std::unique_ptr<net::test_server::BasicHttpResponse> http_response( | 622 std::unique_ptr<net::test_server::BasicHttpResponse> http_response( |
| 621 new net::test_server::BasicHttpResponse); | 623 new net::test_server::BasicHttpResponse); |
| 622 http_response->set_code(net::HTTP_OK); | 624 http_response->set_code(net::HTTP_OK); |
| 623 return std::move(http_response); | 625 return std::move(http_response); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 command_line->AppendSwitch(switches::kSingleProcess); | 855 command_line->AppendSwitch(switches::kSingleProcess); |
| 854 } | 856 } |
| 855 }; | 857 }; |
| 856 | 858 |
| 857 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestSingleProcess, | 859 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestSingleProcess, |
| 858 RenderThreadShutdownTest) { | 860 RenderThreadShutdownTest) { |
| 859 SimpleTest(GetTestUrl("indexeddb", "shutdown_with_requests.html")); | 861 SimpleTest(GetTestUrl("indexeddb", "shutdown_with_requests.html")); |
| 860 } | 862 } |
| 861 | 863 |
| 862 } // namespace content | 864 } // namespace content |
| OLD | NEW |