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