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

Side by Side Diff: content/common_child/indexed_db/indexed_db_dispatcher_unittest.cc

Issue 16325022: move content/common_child to content/child (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/memory/scoped_ptr.h"
6 #include "base/values.h"
7 #include "content/common/indexed_db/indexed_db_key.h"
8 #include "content/common_child/indexed_db/indexed_db_dispatcher.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/WebKit/public/platform/WebData.h"
11 #include "third_party/WebKit/public/platform/WebIDBCallbacks.h"
12
13 using WebKit::WebData;
14 using WebKit::WebIDBCallbacks;
15 using WebKit::WebIDBDatabase;
16 using WebKit::WebIDBDatabaseError;
17 using WebKit::WebIDBKey;
18 using WebKit::WebVector;
19
20 namespace content {
21 namespace {
22
23 class MockCallbacks : public WebIDBCallbacks {
24 public:
25 MockCallbacks() : error_seen_(false) {}
26
27 virtual void onError(const WebIDBDatabaseError&) OVERRIDE {
28 error_seen_ = true;
29 }
30
31 bool error_seen() const { return error_seen_; }
32
33 private:
34 bool error_seen_;
35 };
36
37 } // namespace
38
39 TEST(IndexedDBDispatcherTest, ValueSizeTest) {
40 const std::vector<char> data(kMaxIDBValueSizeInBytes + 1);
41 const WebData value(&data.front(), data.size());
42 const int32 ipc_dummy_id = -1;
43 const int64 transaction_id = 1;
44 const int64 object_store_id = 2;
45
46 MockCallbacks callbacks;
47 IndexedDBDispatcher dispatcher;
48 IndexedDBKey key(0, WebIDBKey::NumberType);
49 dispatcher.RequestIDBDatabasePut(ipc_dummy_id,
50 transaction_id,
51 object_store_id,
52 value,
53 key,
54 WebIDBDatabase::AddOrUpdate,
55 &callbacks,
56 WebVector<long long>(),
57 WebVector<WebVector<WebIDBKey> >());
58
59 EXPECT_TRUE(callbacks.error_seen());
60 }
61
62 } // namespace content
OLDNEW
« no previous file with comments | « content/common_child/indexed_db/indexed_db_dispatcher.cc ('k') | content/common_child/indexed_db/indexed_db_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698