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

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

Issue 5359005: Moved deleting the indexed db context to the WebKitContext destructor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Niptucked. Created 10 years 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 | « chrome/browser/in_process_webkit/webkit_context.cc ('k') | chrome/browser/profile.cc » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/browser/browser_thread.h" 5 #include "chrome/browser/browser_thread.h"
6 #include "chrome/browser/in_process_webkit/dom_storage_context.h" 6 #include "chrome/browser/in_process_webkit/dom_storage_context.h"
7 #include "chrome/browser/in_process_webkit/webkit_context.h" 7 #include "chrome/browser/in_process_webkit/webkit_context.h"
8 #include "chrome/test/testing_profile.h" 8 #include "chrome/test/testing_profile.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 12 matching lines...) Expand all
23 23
24 int purge_count() const { return purge_count_; } 24 int purge_count() const { return purge_count_; }
25 25
26 private: 26 private:
27 int purge_count_; 27 int purge_count_;
28 }; 28 };
29 29
30 TEST(WebKitContextTest, Basic) { 30 TEST(WebKitContextTest, Basic) {
31 TestingProfile profile; 31 TestingProfile profile;
32 32
33 scoped_refptr<WebKitContext> context1(new WebKitContext(&profile)); 33 scoped_refptr<WebKitContext> context1(new WebKitContext(&profile, false));
34 EXPECT_TRUE(profile.GetPath() == context1->data_path()); 34 EXPECT_TRUE(profile.GetPath() == context1->data_path());
35 EXPECT_TRUE(profile.IsOffTheRecord() == context1->is_incognito()); 35 EXPECT_TRUE(profile.IsOffTheRecord() == context1->is_incognito());
36 36
37 scoped_refptr<WebKitContext> context2(new WebKitContext(&profile)); 37 scoped_refptr<WebKitContext> context2(new WebKitContext(&profile, false));
38 EXPECT_TRUE(context1->data_path() == context2->data_path()); 38 EXPECT_TRUE(context1->data_path() == context2->data_path());
39 EXPECT_TRUE(context1->is_incognito() == context2->is_incognito()); 39 EXPECT_TRUE(context1->is_incognito() == context2->is_incognito());
40 } 40 }
41 41
42 TEST(WebKitContextTest, PurgeMemory) { 42 TEST(WebKitContextTest, PurgeMemory) {
43 // Start up a WebKit thread for the WebKitContext to call the 43 // Start up a WebKit thread for the WebKitContext to call the
44 // DOMStorageContext on. 44 // DOMStorageContext on.
45 BrowserThread webkit_thread(BrowserThread::WEBKIT); 45 BrowserThread webkit_thread(BrowserThread::WEBKIT);
46 webkit_thread.Start(); 46 webkit_thread.Start();
47 47
48 // Create the contexts. 48 // Create the contexts.
49 TestingProfile profile; 49 TestingProfile profile;
50 scoped_refptr<WebKitContext> context(new WebKitContext(&profile)); 50 scoped_refptr<WebKitContext> context(new WebKitContext(&profile, false));
51 MockDOMStorageContext* mock_context = 51 MockDOMStorageContext* mock_context =
52 new MockDOMStorageContext(context.get()); 52 new MockDOMStorageContext(context.get());
53 context->set_dom_storage_context(mock_context); // Takes ownership. 53 context->set_dom_storage_context(mock_context); // Takes ownership.
54 54
55 // Ensure PurgeMemory() calls our mock object on the right thread. 55 // Ensure PurgeMemory() calls our mock object on the right thread.
56 EXPECT_EQ(0, mock_context->purge_count()); 56 EXPECT_EQ(0, mock_context->purge_count());
57 context->PurgeMemory(); 57 context->PurgeMemory();
58 webkit_thread.Stop(); // Blocks until all tasks are complete. 58 webkit_thread.Stop(); // Blocks until all tasks are complete.
59 EXPECT_EQ(1, mock_context->purge_count()); 59 EXPECT_EQ(1, mock_context->purge_count());
60 } 60 }
OLDNEW
« no previous file with comments | « chrome/browser/in_process_webkit/webkit_context.cc ('k') | chrome/browser/profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698