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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
| 10 #include "base/test/thread_test_helper.h" |
10 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
11 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/test/in_process_browser_test.h" | 13 #include "chrome/test/in_process_browser_test.h" |
13 #include "chrome/test/testing_profile.h" | 14 #include "chrome/test/testing_profile.h" |
14 #include "chrome/test/thread_test_helper.h" | |
15 #include "chrome/test/ui_test_utils.h" | 15 #include "chrome/test/ui_test_utils.h" |
16 #include "content/browser/in_process_webkit/indexed_db_context.h" | 16 #include "content/browser/in_process_webkit/indexed_db_context.h" |
17 #include "content/browser/in_process_webkit/webkit_context.h" | 17 #include "content/browser/in_process_webkit/webkit_context.h" |
18 #include "content/browser/tab_contents/tab_contents.h" | 18 #include "content/browser/tab_contents/tab_contents.h" |
19 #include "content/common/content_switches.h" | 19 #include "content/common/content_switches.h" |
20 | 20 |
21 // This browser test is aimed towards exercising the IndexedDB bindings and | 21 // This browser test is aimed towards exercising the IndexedDB bindings and |
22 // the actual implementation that lives in the browser side (in_process_webkit). | 22 // the actual implementation that lives in the browser side (in_process_webkit). |
23 class IndexedDBBrowserTest : public InProcessBrowserTest { | 23 class IndexedDBBrowserTest : public InProcessBrowserTest { |
24 public: | 24 public: |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 140 |
141 // Create the scope which will ensure we run the destructor of the webkit | 141 // Create the scope which will ensure we run the destructor of the webkit |
142 // context which should trigger the clean up. | 142 // context which should trigger the clean up. |
143 { | 143 { |
144 TestingProfile profile; | 144 TestingProfile profile; |
145 WebKitContext *webkit_context = profile.GetWebKitContext(); | 145 WebKitContext *webkit_context = profile.GetWebKitContext(); |
146 webkit_context->indexed_db_context()->set_data_path(indexeddb_dir); | 146 webkit_context->indexed_db_context()->set_data_path(indexeddb_dir); |
147 webkit_context->set_clear_local_state_on_exit(true); | 147 webkit_context->set_clear_local_state_on_exit(true); |
148 } | 148 } |
149 // Make sure we wait until the destructor has run. | 149 // Make sure we wait until the destructor has run. |
150 scoped_refptr<ThreadTestHelper> helper( | 150 scoped_refptr<base::ThreadTestHelper> helper( |
151 new ThreadTestHelper(BrowserThread::WEBKIT)); | 151 new base::ThreadTestHelper( |
| 152 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::WEBKIT))); |
152 ASSERT_TRUE(helper->Run()); | 153 ASSERT_TRUE(helper->Run()); |
153 | 154 |
154 // Because we specified https for scheme to be skipped the second file | 155 // Because we specified https for scheme to be skipped the second file |
155 // should survive and the first go into vanity. | 156 // should survive and the first go into vanity. |
156 ASSERT_FALSE(file_util::PathExists(temp_file_path_1)); | 157 ASSERT_FALSE(file_util::PathExists(temp_file_path_1)); |
157 ASSERT_TRUE(file_util::PathExists(temp_file_path_2)); | 158 ASSERT_TRUE(file_util::PathExists(temp_file_path_2)); |
158 } | 159 } |
159 | 160 |
160 class IndexedDBBrowserTestWithGCExposed : public IndexedDBBrowserTest { | 161 class IndexedDBBrowserTestWithGCExposed : public IndexedDBBrowserTest { |
161 public: | 162 public: |
162 virtual void SetUpCommandLine(CommandLine* command_line) { | 163 virtual void SetUpCommandLine(CommandLine* command_line) { |
163 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); | 164 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); |
164 } | 165 } |
165 }; | 166 }; |
166 | 167 |
167 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithGCExposed, | 168 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithGCExposed, |
168 DatabaseCallbacksTest) { | 169 DatabaseCallbacksTest) { |
169 SimpleTest( | 170 SimpleTest( |
170 testUrl(FilePath(FILE_PATH_LITERAL("database_callbacks_first.html")))); | 171 testUrl(FilePath(FILE_PATH_LITERAL("database_callbacks_first.html")))); |
171 } | 172 } |
OLD | NEW |