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

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

Issue 9467016: Get rid of WebKitContext. Only two out of six HTML5 related objects were in it and it was just a gl… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix bug Created 8 years, 10 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
OLDNEW
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/browser/in_process_webkit/webkit_context.h"
12 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
13 #include "content/public/common/url_constants.h" 12 #include "content/public/common/url_constants.h"
14 #include "content/test/test_browser_context.h" 13 #include "content/test/test_browser_context.h"
15 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
16 #include "webkit/quota/special_storage_policy.h" 15 #include "webkit/quota/special_storage_policy.h"
17 16
18 using content::BrowserContext; 17 using content::BrowserContext;
19 using content::BrowserThread; 18 using content::BrowserThread;
20 19
21 typedef InProcessBrowserTest DOMStorageBrowserTest; 20 typedef InProcessBrowserTest DOMStorageBrowserTest;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 FilePath temp_file_path_2 = domstorage_dir.Append(file_name_2); 74 FilePath temp_file_path_2 = domstorage_dir.Append(file_name_2);
76 75
77 ASSERT_EQ(1, file_util::WriteFile(temp_file_path_1, ".", 1)); 76 ASSERT_EQ(1, file_util::WriteFile(temp_file_path_1, ".", 1));
78 ASSERT_EQ(1, file_util::WriteFile(temp_file_path_2, "o", 1)); 77 ASSERT_EQ(1, file_util::WriteFile(temp_file_path_2, "o", 1));
79 78
80 // 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
81 // context which should trigger the clean up. 80 // context which should trigger the clean up.
82 { 81 {
83 TestBrowserContext browser_context; 82 TestBrowserContext browser_context;
84 browser_context.SetSpecialStoragePolicy(new TestSpecialStoragePolicy()); 83 browser_context.SetSpecialStoragePolicy(new TestSpecialStoragePolicy());
85 WebKitContext* webkit_context = BrowserContext::GetWebKitContext( 84 DOMStorageContextImpl* dom_storage_context =
86 &browser_context); 85 static_cast<DOMStorageContextImpl*>(
87 webkit_context->dom_storage_context()-> 86 BrowserContext::GetDOMStorageContext(&browser_context));
88 set_data_path_for_testing(temp_dir.path()); 87 dom_storage_context->set_data_path_for_testing(temp_dir.path());
89 webkit_context->dom_storage_context()->set_clear_local_state_on_exit(true); 88 dom_storage_context->set_clear_local_state_on_exit(true);
90 } 89 }
91 // Make sure we wait until the destructor has run. 90 // Make sure we wait until the destructor has run.
92 scoped_refptr<base::ThreadTestHelper> helper( 91 scoped_refptr<base::ThreadTestHelper> helper(
93 new base::ThreadTestHelper( 92 new base::ThreadTestHelper(
94 BrowserThread::GetMessageLoopProxyForThread( 93 BrowserThread::GetMessageLoopProxyForThread(
95 BrowserThread::WEBKIT_DEPRECATED))); 94 BrowserThread::WEBKIT_DEPRECATED)));
96 ASSERT_TRUE(helper->Run()); 95 ASSERT_TRUE(helper->Run());
97 96
98 // 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
99 // should survive and the first go into vanity. 98 // should survive and the first go into vanity.
100 ASSERT_FALSE(file_util::PathExists(temp_file_path_1)); 99 ASSERT_FALSE(file_util::PathExists(temp_file_path_1));
101 ASSERT_TRUE(file_util::PathExists(temp_file_path_2)); 100 ASSERT_TRUE(file_util::PathExists(temp_file_path_2));
102 } 101 }
OLDNEW
« no previous file with comments | « content/browser/in_process_webkit/dom_storage_area.h ('k') | content/browser/in_process_webkit/dom_storage_context_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698