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_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/test/thread_test_helper.h" | 9 #include "base/test/thread_test_helper.h" |
10 #include "content/browser/web_contents/web_contents_impl.h" | 10 #include "content/browser/web_contents/web_contents_impl.h" |
11 #include "content/public/browser/browser_context.h" | 11 #include "content/public/browser/browser_context.h" |
12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
13 #include "content/public/browser/storage_partition.h" | 13 #include "content/public/browser/storage_partition.h" |
14 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
15 #include "content/public/test/browser_test_utils.h" | 15 #include "content/public/test/browser_test_utils.h" |
16 #include "content/public/test/content_browser_test.h" | 16 #include "content/public/test/content_browser_test.h" |
17 #include "content/public/test/content_browser_test_utils.h" | 17 #include "content/public/test/content_browser_test_utils.h" |
18 #include "content/shell/browser/shell.h" | 18 #include "content/shell/browser/shell.h" |
19 #include "webkit/browser/quota/quota_manager.h" | 19 #include "webkit/browser/quota/quota_manager.h" |
20 | 20 |
21 using quota::QuotaManager; | 21 using storage::QuotaManager; |
22 | 22 |
23 namespace content { | 23 namespace content { |
24 | 24 |
25 // This browser test is aimed towards exercising the FileAPI bindings and | 25 // This browser test is aimed towards exercising the FileAPI bindings and |
26 // the actual implementation that lives in the browser side. | 26 // the actual implementation that lives in the browser side. |
27 class FileSystemBrowserTest : public ContentBrowserTest { | 27 class FileSystemBrowserTest : public ContentBrowserTest { |
28 public: | 28 public: |
29 FileSystemBrowserTest() {} | 29 FileSystemBrowserTest() {} |
30 | 30 |
31 void SimpleTest(const GURL& test_url, bool incognito = false) { | 31 void SimpleTest(const GURL& test_url, bool incognito = false) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 static void SetTempQuota(int64 bytes, scoped_refptr<QuotaManager> qm) { | 64 static void SetTempQuota(int64 bytes, scoped_refptr<QuotaManager> qm) { |
65 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 65 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
66 BrowserThread::PostTask( | 66 BrowserThread::PostTask( |
67 BrowserThread::IO, FROM_HERE, | 67 BrowserThread::IO, FROM_HERE, |
68 base::Bind(&FileSystemBrowserTestWithLowQuota::SetTempQuota, bytes, | 68 base::Bind(&FileSystemBrowserTestWithLowQuota::SetTempQuota, bytes, |
69 qm)); | 69 qm)); |
70 return; | 70 return; |
71 } | 71 } |
72 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 72 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
73 qm->SetTemporaryGlobalOverrideQuota(bytes, quota::QuotaCallback()); | 73 qm->SetTemporaryGlobalOverrideQuota(bytes, storage::QuotaCallback()); |
74 // Don't return until the quota has been set. | 74 // Don't return until the quota has been set. |
75 scoped_refptr<base::ThreadTestHelper> helper(new base::ThreadTestHelper( | 75 scoped_refptr<base::ThreadTestHelper> helper(new base::ThreadTestHelper( |
76 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB).get())); | 76 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB).get())); |
77 ASSERT_TRUE(helper->Run()); | 77 ASSERT_TRUE(helper->Run()); |
78 } | 78 } |
79 }; | 79 }; |
80 | 80 |
81 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, RequestTest) { | 81 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, RequestTest) { |
82 SimpleTest(GetTestUrl("fileapi", "request_test.html")); | 82 SimpleTest(GetTestUrl("fileapi", "request_test.html")); |
83 } | 83 } |
84 | 84 |
85 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, CreateTest) { | 85 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, CreateTest) { |
86 SimpleTest(GetTestUrl("fileapi", "create_test.html")); | 86 SimpleTest(GetTestUrl("fileapi", "create_test.html")); |
87 } | 87 } |
88 | 88 |
89 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTestWithLowQuota, QuotaTest) { | 89 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTestWithLowQuota, QuotaTest) { |
90 SimpleTest(GetTestUrl("fileapi", "quota_test.html")); | 90 SimpleTest(GetTestUrl("fileapi", "quota_test.html")); |
91 } | 91 } |
92 | 92 |
93 } // namespace content | 93 } // namespace content |
OLD | NEW |