OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "base/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/scoped_temp_dir.h" | 7 #include "base/scoped_temp_dir.h" |
8 #include "base/test/thread_test_helper.h" | 8 #include "base/test/thread_test_helper.h" |
9 #include "chrome/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
10 #include "content/browser/in_process_webkit/dom_storage_context_impl.h" | 10 #include "content/browser/in_process_webkit/dom_storage_context_impl.h" |
11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
12 #include "content/public/common/url_constants.h" | 12 #include "content/public/common/url_constants.h" |
13 #include "content/test/test_browser_context.h" | 13 #include "content/test/test_browser_context.h" |
14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
15 #include "webkit/dom_storage/dom_storage_types.h" | |
16 #include "webkit/quota/special_storage_policy.h" | 15 #include "webkit/quota/special_storage_policy.h" |
17 | 16 |
18 #ifdef ENABLE_NEW_DOM_STORAGE_BACKEND | |
19 // No longer applicable. | |
20 #else | |
21 | |
22 using content::BrowserContext; | 17 using content::BrowserContext; |
23 using content::BrowserThread; | 18 using content::BrowserThread; |
24 | 19 |
25 typedef InProcessBrowserTest DOMStorageBrowserTest; | 20 typedef InProcessBrowserTest DOMStorageBrowserTest; |
26 | 21 |
27 namespace { | 22 namespace { |
28 | 23 |
29 class TestSpecialStoragePolicy : public quota::SpecialStoragePolicy { | 24 class TestSpecialStoragePolicy : public quota::SpecialStoragePolicy { |
30 public: | 25 public: |
31 TestSpecialStoragePolicy() { | 26 TestSpecialStoragePolicy() { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 78 |
84 // Create the scope which will ensure we run the destructor of the webkit | 79 // Create the scope which will ensure we run the destructor of the webkit |
85 // context which should trigger the clean up. | 80 // context which should trigger the clean up. |
86 { | 81 { |
87 TestBrowserContext browser_context; | 82 TestBrowserContext browser_context; |
88 browser_context.SetSpecialStoragePolicy(new TestSpecialStoragePolicy()); | 83 browser_context.SetSpecialStoragePolicy(new TestSpecialStoragePolicy()); |
89 DOMStorageContextImpl* dom_storage_context = | 84 DOMStorageContextImpl* dom_storage_context = |
90 static_cast<DOMStorageContextImpl*>( | 85 static_cast<DOMStorageContextImpl*>( |
91 BrowserContext::GetDOMStorageContext(&browser_context)); | 86 BrowserContext::GetDOMStorageContext(&browser_context)); |
92 dom_storage_context->set_data_path_for_testing(temp_dir.path()); | 87 dom_storage_context->set_data_path_for_testing(temp_dir.path()); |
93 dom_storage_context->SetClearLocalState(true); | 88 dom_storage_context->set_clear_local_state_on_exit(true); |
94 } | 89 } |
95 // Make sure we wait until the destructor has run. | 90 // Make sure we wait until the destructor has run. |
96 scoped_refptr<base::ThreadTestHelper> helper( | 91 scoped_refptr<base::ThreadTestHelper> helper( |
97 new base::ThreadTestHelper( | 92 new base::ThreadTestHelper( |
98 BrowserThread::GetMessageLoopProxyForThread( | 93 BrowserThread::GetMessageLoopProxyForThread( |
99 BrowserThread::WEBKIT_DEPRECATED))); | 94 BrowserThread::WEBKIT_DEPRECATED))); |
100 ASSERT_TRUE(helper->Run()); | 95 ASSERT_TRUE(helper->Run()); |
101 | 96 |
102 // Because we specified https for scheme to be skipped the second file | 97 // Because we specified https for scheme to be skipped the second file |
103 // should survive and the first go into vanity. | 98 // should survive and the first go into vanity. |
104 ASSERT_FALSE(file_util::PathExists(temp_file_path_1)); | 99 ASSERT_FALSE(file_util::PathExists(temp_file_path_1)); |
105 ASSERT_TRUE(file_util::PathExists(temp_file_path_2)); | 100 ASSERT_TRUE(file_util::PathExists(temp_file_path_2)); |
106 } | 101 } |
107 | |
108 #endif // ENABLE_NEW_DOM_STORAGE_BACKEND | |
OLD | NEW |