OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 IDBValue::create()); | 69 IDBValue::create()); |
70 } | 70 } |
71 | 71 |
72 TEST(IDBRequestTest, AbortErrorAfterAbort) { | 72 TEST(IDBRequestTest, AbortErrorAfterAbort) { |
73 V8TestingScope scope; | 73 V8TestingScope scope; |
74 IDBTransaction* transaction = nullptr; | 74 IDBTransaction* transaction = nullptr; |
75 IDBRequest* request = IDBRequest::create( | 75 IDBRequest* request = IDBRequest::create( |
76 scope.getScriptState(), IDBAny::createUndefined(), transaction); | 76 scope.getScriptState(), IDBAny::createUndefined(), transaction); |
77 EXPECT_EQ(request->readyState(), "pending"); | 77 EXPECT_EQ(request->readyState(), "pending"); |
78 | 78 |
79 // Simulate the IDBTransaction having received onAbort from back end and abort
ing the request: | 79 // Simulate the IDBTransaction having received onAbort from back end and |
| 80 // aborting the request: |
80 request->abort(); | 81 request->abort(); |
81 | 82 |
82 // Now simulate the back end having fired an abort error at the request to cle
ar up any intermediaries. | 83 // Now simulate the back end having fired an abort error at the request to |
83 // Ensure an assertion is not raised. | 84 // clear up any intermediaries. Ensure an assertion is not raised. |
84 request->onError(DOMException::create(AbortError, "Description goes here.")); | 85 request->onError(DOMException::create(AbortError, "Description goes here.")); |
85 | 86 |
86 // Stop the request lest it be GCed and its destructor | 87 // Stop the request lest it be GCed and its destructor |
87 // finds the object in a pending state (and asserts.) | 88 // finds the object in a pending state (and asserts.) |
88 scope.getExecutionContext()->notifyContextDestroyed(); | 89 scope.getExecutionContext()->notifyContextDestroyed(); |
89 } | 90 } |
90 | 91 |
91 TEST(IDBRequestTest, ConnectionsAfterStopping) { | 92 TEST(IDBRequestTest, ConnectionsAfterStopping) { |
92 V8TestingScope scope; | 93 V8TestingScope scope; |
93 const int64_t transactionId = 1234; | 94 const int64_t transactionId = 1234; |
(...skipping 22 matching lines...) Expand all Loading... |
116 scope.getScriptState(), callbacks, transactionId, version); | 117 scope.getScriptState(), callbacks, transactionId, version); |
117 EXPECT_EQ(request->readyState(), "pending"); | 118 EXPECT_EQ(request->readyState(), "pending"); |
118 | 119 |
119 scope.getExecutionContext()->notifyContextDestroyed(); | 120 scope.getExecutionContext()->notifyContextDestroyed(); |
120 request->onSuccess(std::move(backend), metadata); | 121 request->onSuccess(std::move(backend), metadata); |
121 } | 122 } |
122 } | 123 } |
123 | 124 |
124 } // namespace | 125 } // namespace |
125 } // namespace blink | 126 } // namespace blink |
OLD | NEW |