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

Side by Side Diff: content/browser/in_process_webkit/webkit_context_unittest.cc

Issue 7053030: Initial IndexedDBQuotaClient implementation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make webkit thread outlive IndexedDBContext Created 9 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
« no previous file with comments | « content/browser/in_process_webkit/webkit_context.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/test/testing_profile.h" 5 #include "chrome/test/testing_profile.h"
6 #include "content/browser/browser_thread.h" 6 #include "content/browser/browser_thread.h"
7 #include "content/browser/in_process_webkit/dom_storage_context.h" 7 #include "content/browser/in_process_webkit/dom_storage_context.h"
8 #include "content/browser/in_process_webkit/webkit_context.h" 8 #include "content/browser/in_process_webkit/webkit_context.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 15 matching lines...) Expand all
26 26
27 private: 27 private:
28 int purge_count_; 28 int purge_count_;
29 }; 29 };
30 30
31 TEST(WebKitContextTest, Basic) { 31 TEST(WebKitContextTest, Basic) {
32 TestingProfile profile; 32 TestingProfile profile;
33 scoped_refptr<WebKitContext> context1(new WebKitContext( 33 scoped_refptr<WebKitContext> context1(new WebKitContext(
34 profile.IsOffTheRecord(), profile.GetPath(), 34 profile.IsOffTheRecord(), profile.GetPath(),
35 profile.GetSpecialStoragePolicy(), 35 profile.GetSpecialStoragePolicy(),
36 false)); 36 false, NULL, NULL));
37 EXPECT_TRUE(profile.GetPath() == context1->data_path()); 37 EXPECT_TRUE(profile.GetPath() == context1->data_path());
38 EXPECT_TRUE(profile.IsOffTheRecord() == context1->is_incognito()); 38 EXPECT_TRUE(profile.IsOffTheRecord() == context1->is_incognito());
39 39
40 scoped_refptr<WebKitContext> context2(new WebKitContext( 40 scoped_refptr<WebKitContext> context2(new WebKitContext(
41 profile.IsOffTheRecord(), profile.GetPath(), 41 profile.IsOffTheRecord(), profile.GetPath(),
42 profile.GetSpecialStoragePolicy(), 42 profile.GetSpecialStoragePolicy(),
43 false)); 43 false, NULL, NULL));
44 EXPECT_TRUE(context1->data_path() == context2->data_path()); 44 EXPECT_TRUE(context1->data_path() == context2->data_path());
45 EXPECT_TRUE(context1->is_incognito() == context2->is_incognito()); 45 EXPECT_TRUE(context1->is_incognito() == context2->is_incognito());
46 } 46 }
47 47
48 TEST(WebKitContextTest, PurgeMemory) { 48 TEST(WebKitContextTest, PurgeMemory) {
49 // Start up a WebKit thread for the WebKitContext to call the 49 // Start up a WebKit thread for the WebKitContext to call the
50 // DOMStorageContext on. 50 // DOMStorageContext on.
51 BrowserThread webkit_thread(BrowserThread::WEBKIT); 51 BrowserThread webkit_thread(BrowserThread::WEBKIT);
52 webkit_thread.Start(); 52 webkit_thread.Start();
53 53
54 // Create the contexts. 54 // Create the contexts.
55 TestingProfile profile; 55 TestingProfile profile;
56 scoped_refptr<WebKitContext> context(new WebKitContext( 56 scoped_refptr<WebKitContext> context(new WebKitContext(
57 profile.IsOffTheRecord(), profile.GetPath(), 57 profile.IsOffTheRecord(), profile.GetPath(),
58 profile.GetSpecialStoragePolicy(), 58 profile.GetSpecialStoragePolicy(),
59 false)); 59 false, NULL, NULL));
60 MockDOMStorageContext* mock_context = new MockDOMStorageContext( 60 MockDOMStorageContext* mock_context = new MockDOMStorageContext(
61 context.get(), profile.GetSpecialStoragePolicy()); 61 context.get(), profile.GetSpecialStoragePolicy());
62 context->set_dom_storage_context(mock_context); // Takes ownership. 62 context->set_dom_storage_context(mock_context); // Takes ownership.
63 63
64 // Ensure PurgeMemory() calls our mock object on the right thread. 64 // Ensure PurgeMemory() calls our mock object on the right thread.
65 EXPECT_EQ(0, mock_context->purge_count()); 65 EXPECT_EQ(0, mock_context->purge_count());
66 context->PurgeMemory(); 66 context->PurgeMemory();
67 webkit_thread.Stop(); // Blocks until all tasks are complete. 67 webkit_thread.Stop(); // Blocks until all tasks are complete.
68 EXPECT_EQ(1, mock_context->purge_count()); 68 EXPECT_EQ(1, mock_context->purge_count());
69 } 69 }
OLDNEW
« no previous file with comments | « content/browser/in_process_webkit/webkit_context.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698