OLD | NEW |
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 "content/browser/in_process_webkit/dom_storage_context.h" | 5 #include "content/browser/in_process_webkit/dom_storage_context.h" |
6 #include "content/browser/in_process_webkit/webkit_context.h" | 6 #include "content/browser/in_process_webkit/webkit_context.h" |
7 #include "content/test/test_browser_context.h" | 7 #include "content/test/test_browser_context.h" |
8 #include "content/test/test_browser_thread.h" | 8 #include "content/test/test_browser_thread.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
| 11 using content::BrowserThread; |
| 12 |
11 class MockDOMStorageContext : public DOMStorageContext { | 13 class MockDOMStorageContext : public DOMStorageContext { |
12 public: | 14 public: |
13 MockDOMStorageContext(WebKitContext* webkit_context, | 15 MockDOMStorageContext(WebKitContext* webkit_context, |
14 quota::SpecialStoragePolicy* special_storage_policy) | 16 quota::SpecialStoragePolicy* special_storage_policy) |
15 : DOMStorageContext(webkit_context, special_storage_policy), | 17 : DOMStorageContext(webkit_context, special_storage_policy), |
16 purge_count_(0) { | 18 purge_count_(0) { |
17 } | 19 } |
18 | 20 |
19 virtual void PurgeMemory() { | 21 virtual void PurgeMemory() { |
20 EXPECT_FALSE(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 22 EXPECT_FALSE(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 EXPECT_EQ(0, mock_context->purge_count()); | 67 EXPECT_EQ(0, mock_context->purge_count()); |
66 context->PurgeMemory(); | 68 context->PurgeMemory(); |
67 MessageLoop::current()->RunAllPending(); | 69 MessageLoop::current()->RunAllPending(); |
68 EXPECT_EQ(1, mock_context->purge_count()); | 70 EXPECT_EQ(1, mock_context->purge_count()); |
69 } | 71 } |
70 // WebKitContext's destructor posts stuff to the webkit thread. Let | 72 // WebKitContext's destructor posts stuff to the webkit thread. Let |
71 // WebKitContext go out of scope here before processing WebKitContext's | 73 // WebKitContext go out of scope here before processing WebKitContext's |
72 // clean-up tasks. | 74 // clean-up tasks. |
73 MessageLoop::current()->RunAllPending(); | 75 MessageLoop::current()->RunAllPending(); |
74 } | 76 } |
OLD | NEW |