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/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 virtual int64 RequestDiskUsage() { | 105 virtual int64 RequestDiskUsage() { |
106 PostTaskAndReplyWithResult( | 106 PostTaskAndReplyWithResult( |
107 GetContext()->TaskRunner(), | 107 GetContext()->TaskRunner(), |
108 FROM_HERE, | 108 FROM_HERE, |
109 base::Bind(&IndexedDBContext::GetOriginDiskUsage, | 109 base::Bind(&IndexedDBContext::GetOriginDiskUsage, |
110 GetContext(), | 110 GetContext(), |
111 GURL("file:///")), | 111 GURL("file:///")), |
112 base::Bind(&IndexedDBBrowserTest::DidGetDiskUsage, this)); | 112 base::Bind(&IndexedDBBrowserTest::DidGetDiskUsage, this)); |
113 scoped_refptr<base::ThreadTestHelper> helper(new base::ThreadTestHelper( | 113 scoped_refptr<base::ThreadTestHelper> helper(new base::ThreadTestHelper( |
114 BrowserMainLoop::GetInstance()->indexed_db_thread() | 114 BrowserMainLoop::GetInstance()->indexed_db_thread() |
115 ->message_loop_proxy())); | 115 ->message_loop_proxy().get())); |
116 EXPECT_TRUE(helper->Run()); | 116 EXPECT_TRUE(helper->Run()); |
117 // Wait for DidGetDiskUsage to be called. | 117 // Wait for DidGetDiskUsage to be called. |
118 base::MessageLoop::current()->RunUntilIdle(); | 118 base::MessageLoop::current()->RunUntilIdle(); |
119 return disk_usage_; | 119 return disk_usage_; |
120 } | 120 } |
121 private: | 121 private: |
122 virtual void DidGetDiskUsage(int64 bytes) { | 122 virtual void DidGetDiskUsage(int64 bytes) { |
123 EXPECT_GT(bytes, 0); | 123 EXPECT_GT(bytes, 0); |
124 disk_usage_ = bytes; | 124 disk_usage_ = bytes; |
125 } | 125 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 class IndexedDBBrowserTestWithPreexistingLevelDB : public IndexedDBBrowserTest { | 251 class IndexedDBBrowserTestWithPreexistingLevelDB : public IndexedDBBrowserTest { |
252 public: | 252 public: |
253 virtual void SetUpOnMainThread() OVERRIDE { | 253 virtual void SetUpOnMainThread() OVERRIDE { |
254 scoped_refptr<IndexedDBContextImpl> context = GetContext(); | 254 scoped_refptr<IndexedDBContextImpl> context = GetContext(); |
255 context->TaskRunner()->PostTask( | 255 context->TaskRunner()->PostTask( |
256 FROM_HERE, | 256 FROM_HERE, |
257 base::Bind( | 257 base::Bind( |
258 &CopyLevelDBToProfile, shell(), context, EnclosingLevelDBDir())); | 258 &CopyLevelDBToProfile, shell(), context, EnclosingLevelDBDir())); |
259 scoped_refptr<base::ThreadTestHelper> helper(new base::ThreadTestHelper( | 259 scoped_refptr<base::ThreadTestHelper> helper(new base::ThreadTestHelper( |
260 BrowserMainLoop::GetInstance()->indexed_db_thread() | 260 BrowserMainLoop::GetInstance()->indexed_db_thread() |
261 ->message_loop_proxy())); | 261 ->message_loop_proxy().get())); |
262 ASSERT_TRUE(helper->Run()); | 262 ASSERT_TRUE(helper->Run()); |
263 } | 263 } |
264 | 264 |
265 virtual std::string EnclosingLevelDBDir() = 0; | 265 virtual std::string EnclosingLevelDBDir() = 0; |
266 | 266 |
267 }; | 267 }; |
268 | 268 |
269 class IndexedDBBrowserTestWithVersion0Schema : public | 269 class IndexedDBBrowserTestWithVersion0Schema : public |
270 IndexedDBBrowserTestWithPreexistingLevelDB { | 270 IndexedDBBrowserTestWithPreexistingLevelDB { |
271 virtual std::string EnclosingLevelDBDir() OVERRIDE { | 271 virtual std::string EnclosingLevelDBDir() OVERRIDE { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 TitleWatcher title_watcher(new_shell->web_contents(), expected_title16); | 416 TitleWatcher title_watcher(new_shell->web_contents(), expected_title16); |
417 | 417 |
418 base::KillProcess( | 418 base::KillProcess( |
419 shell()->web_contents()->GetRenderProcessHost()->GetHandle(), 0, true); | 419 shell()->web_contents()->GetRenderProcessHost()->GetHandle(), 0, true); |
420 shell()->Close(); | 420 shell()->Close(); |
421 | 421 |
422 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); | 422 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); |
423 } | 423 } |
424 | 424 |
425 } // namespace content | 425 } // namespace content |
OLD | NEW |