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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 IDBValue::Create()); | 71 IDBValue::Create()); |
72 } | 72 } |
73 | 73 |
74 TEST(IDBRequestTest, AbortErrorAfterAbort) { | 74 TEST(IDBRequestTest, AbortErrorAfterAbort) { |
75 V8TestingScope scope; | 75 V8TestingScope scope; |
76 IDBTransaction* transaction = nullptr; | 76 IDBTransaction* transaction = nullptr; |
77 IDBRequest* request = IDBRequest::Create( | 77 IDBRequest* request = IDBRequest::Create( |
78 scope.GetScriptState(), IDBAny::CreateUndefined(), transaction); | 78 scope.GetScriptState(), IDBAny::CreateUndefined(), transaction); |
79 EXPECT_EQ(request->readyState(), "pending"); | 79 EXPECT_EQ(request->readyState(), "pending"); |
80 | 80 |
81 // Simulate the IDBTransaction having received onAbort from back end and | 81 // Simulate the IDBTransaction having received OnAbort from back end and |
82 // aborting the request: | 82 // aborting the request: |
83 request->Abort(); | 83 request->Abort(); |
84 | 84 |
85 // Now simulate the back end having fired an abort error at the request to | 85 // Now simulate the back end having fired an abort error at the request to |
86 // clear up any intermediaries. Ensure an assertion is not raised. | 86 // clear up any intermediaries. Ensure an assertion is not raised. |
87 request->OnError(DOMException::Create(kAbortError, "Description goes here.")); | 87 request->OnError(DOMException::Create(kAbortError, "Description goes here.")); |
88 | 88 |
89 // Stop the request lest it be GCed and its destructor | 89 // Stop the request lest it be GCed and its destructor |
90 // finds the object in a pending state (and asserts.) | 90 // finds the object in a pending state (and asserts.) |
91 scope.GetExecutionContext()->NotifyContextDestroyed(); | 91 scope.GetExecutionContext()->NotifyContextDestroyed(); |
(...skipping 28 matching lines...) Expand all Loading... |
120 EXPECT_EQ(request->readyState(), "pending"); | 120 EXPECT_EQ(request->readyState(), "pending"); |
121 std::unique_ptr<WebIDBCallbacks> callbacks = request->CreateWebCallbacks(); | 121 std::unique_ptr<WebIDBCallbacks> callbacks = request->CreateWebCallbacks(); |
122 | 122 |
123 scope.GetExecutionContext()->NotifyContextDestroyed(); | 123 scope.GetExecutionContext()->NotifyContextDestroyed(); |
124 callbacks->OnSuccess(backend.release(), metadata); | 124 callbacks->OnSuccess(backend.release(), metadata); |
125 } | 125 } |
126 } | 126 } |
127 | 127 |
128 } // namespace | 128 } // namespace |
129 } // namespace blink | 129 } // namespace blink |
OLD | NEW |