| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/files/file.h" | 7 #include "base/files/file.h" |
| 8 #include "base/files/file_enumerator.h" | 8 #include "base/files/file_enumerator.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 } | 180 } |
| 181 | 181 |
| 182 virtual void DidGetBlobFileCount(int count) { blob_file_count_ = count; } | 182 virtual void DidGetBlobFileCount(int count) { blob_file_count_ = count; } |
| 183 | 183 |
| 184 int64 disk_usage_; | 184 int64 disk_usage_; |
| 185 int blob_file_count_ = 0; | 185 int blob_file_count_ = 0; |
| 186 | 186 |
| 187 DISALLOW_COPY_AND_ASSIGN(IndexedDBBrowserTest); | 187 DISALLOW_COPY_AND_ASSIGN(IndexedDBBrowserTest); |
| 188 }; | 188 }; |
| 189 | 189 |
| 190 class IndexedDBBrowserTestWithExperimentalAPIs |
| 191 : public IndexedDBBrowserTest, |
| 192 public ::testing::WithParamInterface<const char*> { |
| 193 public: |
| 194 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 195 command_line->AppendSwitch( |
| 196 switches::kEnableExperimentalWebPlatformFeatures); |
| 197 } |
| 198 }; |
| 199 |
| 190 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CursorTest) { | 200 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CursorTest) { |
| 191 SimpleTest(GetTestUrl("indexeddb", "cursor_test.html")); | 201 SimpleTest(GetTestUrl("indexeddb", "cursor_test.html")); |
| 192 } | 202 } |
| 193 | 203 |
| 194 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CursorTestIncognito) { | 204 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CursorTestIncognito) { |
| 195 SimpleTest(GetTestUrl("indexeddb", "cursor_test.html"), | 205 SimpleTest(GetTestUrl("indexeddb", "cursor_test.html"), |
| 196 true /* incognito */); | 206 true /* incognito */); |
| 197 } | 207 } |
| 198 | 208 |
| 199 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CursorPrefetch) { | 209 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CursorPrefetch) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 225 } | 235 } |
| 226 | 236 |
| 227 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, TransactionTest) { | 237 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, TransactionTest) { |
| 228 SimpleTest(GetTestUrl("indexeddb", "transaction_test.html")); | 238 SimpleTest(GetTestUrl("indexeddb", "transaction_test.html")); |
| 229 } | 239 } |
| 230 | 240 |
| 231 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CallbackAccounting) { | 241 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CallbackAccounting) { |
| 232 SimpleTest(GetTestUrl("indexeddb", "callback_accounting.html")); | 242 SimpleTest(GetTestUrl("indexeddb", "callback_accounting.html")); |
| 233 } | 243 } |
| 234 | 244 |
| 245 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithExperimentalAPIs, |
| 246 GetAllMaxMessageSize) { |
| 247 SimpleTest(GetTestUrl("indexeddb", "getall_max_message_size.html")); |
| 248 } |
| 249 |
| 235 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DoesntHangTest) { | 250 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DoesntHangTest) { |
| 236 SimpleTest(GetTestUrl("indexeddb", "transaction_run_forever.html")); | 251 SimpleTest(GetTestUrl("indexeddb", "transaction_run_forever.html")); |
| 237 CrashTab(shell()->web_contents()); | 252 CrashTab(shell()->web_contents()); |
| 238 SimpleTest(GetTestUrl("indexeddb", "transaction_not_blocked.html")); | 253 SimpleTest(GetTestUrl("indexeddb", "transaction_not_blocked.html")); |
| 239 } | 254 } |
| 240 | 255 |
| 241 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, Bug84933Test) { | 256 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, Bug84933Test) { |
| 242 const GURL url = GetTestUrl("indexeddb", "bug_84933.html"); | 257 const GURL url = GetTestUrl("indexeddb", "bug_84933.html"); |
| 243 | 258 |
| 244 // Just navigate to the URL. Test will crash if it fails. | 259 // Just navigate to the URL. Test will crash if it fails. |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 http_response->set_code(net::HTTP_OK); | 687 http_response->set_code(net::HTTP_OK); |
| 673 std::string file_contents; | 688 std::string file_contents; |
| 674 if (!base::ReadFileToString(resource_path, &file_contents)) | 689 if (!base::ReadFileToString(resource_path, &file_contents)) |
| 675 return scoped_ptr<net::test_server::HttpResponse>(); | 690 return scoped_ptr<net::test_server::HttpResponse>(); |
| 676 http_response->set_content(file_contents); | 691 http_response->set_content(file_contents); |
| 677 return http_response.Pass(); | 692 return http_response.Pass(); |
| 678 } | 693 } |
| 679 | 694 |
| 680 } // namespace | 695 } // namespace |
| 681 | 696 |
| 682 class IndexedDBBrowserCorruptionTest | 697 // Experimental for IDBObjectStore.getAll() |
| 683 : public IndexedDBBrowserTest, | 698 using IndexedDBBrowserCorruptionTest = IndexedDBBrowserTestWithExperimentalAPIs; |
| 684 public ::testing::WithParamInterface<const char*> { | |
| 685 public: | |
| 686 void SetUpCommandLine(base::CommandLine* command_line) override { | |
| 687 // Experimental for IDBObjectStore.getAll() | |
| 688 command_line->AppendSwitch( | |
| 689 switches::kEnableExperimentalWebPlatformFeatures); | |
| 690 } | |
| 691 }; | |
| 692 | 699 |
| 693 IN_PROC_BROWSER_TEST_P(IndexedDBBrowserCorruptionTest, | 700 IN_PROC_BROWSER_TEST_P(IndexedDBBrowserCorruptionTest, |
| 694 OperationOnCorruptedOpenDatabase) { | 701 OperationOnCorruptedOpenDatabase) { |
| 695 ASSERT_TRUE(embedded_test_server()->Started() || | 702 ASSERT_TRUE(embedded_test_server()->Started() || |
| 696 embedded_test_server()->InitializeAndWaitUntilReady()); | 703 embedded_test_server()->InitializeAndWaitUntilReady()); |
| 697 const GURL& origin_url = embedded_test_server()->base_url(); | 704 const GURL& origin_url = embedded_test_server()->base_url(); |
| 698 embedded_test_server()->RegisterRequestHandler( | 705 embedded_test_server()->RegisterRequestHandler( |
| 699 base::Bind(&CorruptDBRequestHandler, | 706 base::Bind(&CorruptDBRequestHandler, |
| 700 base::Unretained(GetContext()), | 707 base::Unretained(GetContext()), |
| 701 origin_url, | 708 origin_url, |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 command_line->AppendSwitch(switches::kSingleProcess); | 842 command_line->AppendSwitch(switches::kSingleProcess); |
| 836 } | 843 } |
| 837 }; | 844 }; |
| 838 | 845 |
| 839 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestSingleProcess, | 846 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestSingleProcess, |
| 840 RenderThreadShutdownTest) { | 847 RenderThreadShutdownTest) { |
| 841 SimpleTest(GetTestUrl("indexeddb", "shutdown_with_requests.html")); | 848 SimpleTest(GetTestUrl("indexeddb", "shutdown_with_requests.html")); |
| 842 } | 849 } |
| 843 | 850 |
| 844 } // namespace content | 851 } // namespace content |
| OLD | NEW |