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

Side by Side Diff: webkit/plugins/ppapi/quota_file_io_unittest.cc

Issue 7583053: Add MessageLoopProxy::current (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: No need for MessageLoopProxy destruction observer. Created 9 years, 4 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
« no previous file with comments | « webkit/plugins/ppapi/quota_file_io.cc ('k') | webkit/quota/mock_quota_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <deque> 5 #include <deque>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/scoped_callback_factory.h" 8 #include "base/memory/scoped_callback_factory.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/platform_file.h" 10 #include "base/platform_file.h"
(...skipping 11 matching lines...) Expand all
22 namespace ppapi { 22 namespace ppapi {
23 23
24 namespace { 24 namespace {
25 class QuotaMockPluginDelegate : public MockPluginDelegate { 25 class QuotaMockPluginDelegate : public MockPluginDelegate {
26 public: 26 public:
27 typedef PluginDelegate::AvailableSpaceCallback Callback; 27 typedef PluginDelegate::AvailableSpaceCallback Callback;
28 28
29 QuotaMockPluginDelegate() 29 QuotaMockPluginDelegate()
30 : available_space_(0), 30 : available_space_(0),
31 will_update_count_(0), 31 will_update_count_(0),
32 file_thread_(MessageLoopProxy::CreateForCurrentThread()), 32 file_thread_(MessageLoopProxy::current()),
33 runnable_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 33 runnable_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
34 } 34 }
35 virtual ~QuotaMockPluginDelegate() {} 35 virtual ~QuotaMockPluginDelegate() {}
36 36
37 virtual scoped_refptr<MessageLoopProxy> GetFileThreadMessageLoopProxy() { 37 virtual scoped_refptr<MessageLoopProxy> GetFileThreadMessageLoopProxy() {
38 return file_thread_; 38 return file_thread_;
39 } 39 }
40 40
41 virtual void QueryAvailableSpace( 41 virtual void QueryAvailableSpace(
42 const GURL& origin, 42 const GURL& origin,
43 quota::StorageType type, 43 quota::StorageType type,
44 Callback* callback) OVERRIDE { 44 Callback* callback) OVERRIDE {
45 DCHECK(callback); 45 DCHECK(callback);
46 MessageLoopProxy::CreateForCurrentThread()->PostTask( 46 MessageLoopProxy::current()->PostTask(
47 FROM_HERE, runnable_factory_.NewRunnableMethod( 47 FROM_HERE, runnable_factory_.NewRunnableMethod(
48 &QuotaMockPluginDelegate::RunAvailableSpaceCallback, callback)); 48 &QuotaMockPluginDelegate::RunAvailableSpaceCallback, callback));
49 } 49 }
50 50
51 virtual void WillUpdateFile(const GURL& file_path) OVERRIDE { 51 virtual void WillUpdateFile(const GURL& file_path) OVERRIDE {
52 file_path_ = file_path; 52 file_path_ = file_path;
53 ++will_update_count_; 53 ++will_update_count_;
54 } 54 }
55 55
56 virtual void DidUpdateFile(const GURL& file_path, int64_t delta) OVERRIDE { 56 virtual void DidUpdateFile(const GURL& file_path, int64_t delta) OVERRIDE {
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 pop_result(); 479 pop_result();
480 480
481 EXPECT_EQ(22 - 15, quota_plugin_delegate()->available_space()); 481 EXPECT_EQ(22 - 15, quota_plugin_delegate()->available_space());
482 EXPECT_EQ(15, GetPlatformFileSize()); 482 EXPECT_EQ(15, GetPlatformFileSize());
483 ReadPlatformFile(&read_buffer); 483 ReadPlatformFile(&read_buffer);
484 EXPECT_EQ("123355559012345", read_buffer); 484 EXPECT_EQ("123355559012345", read_buffer);
485 } 485 }
486 486
487 } // namespace ppapi 487 } // namespace ppapi
488 } // namespace webkit 488 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/quota_file_io.cc ('k') | webkit/quota/mock_quota_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698