Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/IDBRequestTest.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments from Kent; merge. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 21 matching lines...) Expand all
32 #include "core/dom/ExceptionCode.h" 32 #include "core/dom/ExceptionCode.h"
33 #include "core/dom/ExecutionContext.h" 33 #include "core/dom/ExecutionContext.h"
34 #include "core/testing/NullExecutionContext.h" 34 #include "core/testing/NullExecutionContext.h"
35 #include "modules/indexeddb/IDBDatabaseCallbacks.h" 35 #include "modules/indexeddb/IDBDatabaseCallbacks.h"
36 #include "modules/indexeddb/IDBKey.h" 36 #include "modules/indexeddb/IDBKey.h"
37 #include "modules/indexeddb/IDBOpenDBRequest.h" 37 #include "modules/indexeddb/IDBOpenDBRequest.h"
38 #include "modules/indexeddb/IDBValue.h" 38 #include "modules/indexeddb/IDBValue.h"
39 #include "modules/indexeddb/MockWebIDBDatabase.h" 39 #include "modules/indexeddb/MockWebIDBDatabase.h"
40 #include "platform/SharedBuffer.h" 40 #include "platform/SharedBuffer.h"
41 #include "testing/gtest/include/gtest/gtest.h" 41 #include "testing/gtest/include/gtest/gtest.h"
42 #include "wtf/OwnPtr.h"
43 #include "wtf/PassOwnPtr.h"
44 #include "wtf/PassRefPtr.h" 42 #include "wtf/PassRefPtr.h"
45 #include "wtf/Vector.h" 43 #include "wtf/Vector.h"
46 #include "wtf/dtoa/utils.h" 44 #include "wtf/dtoa/utils.h"
45 #include <memory>
47 #include <v8.h> 46 #include <v8.h>
48 47
49 namespace blink { 48 namespace blink {
50 namespace { 49 namespace {
51 50
52 class IDBRequestTest : public testing::Test { 51 class IDBRequestTest : public testing::Test {
53 public: 52 public:
54 IDBRequestTest() 53 IDBRequestTest()
55 : m_scope(v8::Isolate::GetCurrent()) 54 : m_scope(v8::Isolate::GetCurrent())
56 { 55 {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 114
116 TEST_F(IDBRequestTest, ConnectionsAfterStopping) 115 TEST_F(IDBRequestTest, ConnectionsAfterStopping)
117 { 116 {
118 const int64_t transactionId = 1234; 117 const int64_t transactionId = 1234;
119 const int64_t version = 1; 118 const int64_t version = 1;
120 const int64_t oldVersion = 0; 119 const int64_t oldVersion = 0;
121 const IDBDatabaseMetadata metadata; 120 const IDBDatabaseMetadata metadata;
122 Persistent<IDBDatabaseCallbacks> callbacks = IDBDatabaseCallbacks::create(); 121 Persistent<IDBDatabaseCallbacks> callbacks = IDBDatabaseCallbacks::create();
123 122
124 { 123 {
125 OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); 124 std::unique_ptr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create ();
126 EXPECT_CALL(*backend, abort(transactionId)) 125 EXPECT_CALL(*backend, abort(transactionId))
127 .Times(1); 126 .Times(1);
128 EXPECT_CALL(*backend, close()) 127 EXPECT_CALL(*backend, close())
129 .Times(1); 128 .Times(1);
130 IDBOpenDBRequest* request = IDBOpenDBRequest::create(getScriptState(), c allbacks, transactionId, version); 129 IDBOpenDBRequest* request = IDBOpenDBRequest::create(getScriptState(), c allbacks, transactionId, version);
131 EXPECT_EQ(request->readyState(), "pending"); 130 EXPECT_EQ(request->readyState(), "pending");
132 131
133 getExecutionContext()->stopActiveDOMObjects(); 132 getExecutionContext()->stopActiveDOMObjects();
134 request->onUpgradeNeeded(oldVersion, std::move(backend), metadata, WebID BDataLossNone, String()); 133 request->onUpgradeNeeded(oldVersion, std::move(backend), metadata, WebID BDataLossNone, String());
135 } 134 }
136 135
137 { 136 {
138 OwnPtr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create(); 137 std::unique_ptr<MockWebIDBDatabase> backend = MockWebIDBDatabase::create ();
139 EXPECT_CALL(*backend, close()) 138 EXPECT_CALL(*backend, close())
140 .Times(1); 139 .Times(1);
141 IDBOpenDBRequest* request = IDBOpenDBRequest::create(getScriptState(), c allbacks, transactionId, version); 140 IDBOpenDBRequest* request = IDBOpenDBRequest::create(getScriptState(), c allbacks, transactionId, version);
142 EXPECT_EQ(request->readyState(), "pending"); 141 EXPECT_EQ(request->readyState(), "pending");
143 142
144 getExecutionContext()->stopActiveDOMObjects(); 143 getExecutionContext()->stopActiveDOMObjects();
145 request->onSuccess(std::move(backend), metadata); 144 request->onSuccess(std::move(backend), metadata);
146 } 145 }
147 } 146 }
148 147
149 } // namespace 148 } // namespace
150 } // namespace blink 149 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698