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

Side by Side Diff: chrome/browser/chromeos/drive/file_write_helper_unittest.cc

Issue 14755002: drive: Drop "Drive" from FakeDriveFileSystem and MockDriveFileSystem (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: some more cleanup Created 7 years, 7 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
OLDNEW
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 "chrome/browser/chromeos/drive/file_write_helper.h" 5 #include "chrome/browser/chromeos/drive/file_write_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/threading/thread_restrictions.h" 9 #include "base/threading/thread_restrictions.h"
10 #include "chrome/browser/chromeos/drive/mock_drive_file_system.h" 10 #include "chrome/browser/chromeos/drive/mock_file_system.h"
11 #include "chrome/browser/chromeos/drive/test_util.h" 11 #include "chrome/browser/chromeos/drive/test_util.h"
12 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
13 #include "content/public/test/test_browser_thread.h" 13 #include "content/public/test/test_browser_thread.h"
14 #include "testing/gmock/include/gmock/gmock.h" 14 #include "testing/gmock/include/gmock/gmock.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 using ::testing::StrictMock; 17 using ::testing::StrictMock;
18 using ::testing::_; 18 using ::testing::_;
19 19
20 namespace drive { 20 namespace drive {
(...skipping 23 matching lines...) Expand all
44 *error = error_arg; 44 *error = error_arg;
45 *path = path_arg; 45 *path = path_arg;
46 } 46 }
47 47
48 } // namespace 48 } // namespace
49 49
50 class FileWriteHelperTest : public testing::Test { 50 class FileWriteHelperTest : public testing::Test {
51 public: 51 public:
52 FileWriteHelperTest() 52 FileWriteHelperTest()
53 : ui_thread_(content::BrowserThread::UI, &message_loop_), 53 : ui_thread_(content::BrowserThread::UI, &message_loop_),
54 mock_file_system_(new StrictMock<MockDriveFileSystem>) { 54 mock_file_system_(new StrictMock<MockFileSystem>) {
55 } 55 }
56 56
57 protected: 57 protected:
58 MessageLoopForUI message_loop_; 58 MessageLoopForUI message_loop_;
59 content::TestBrowserThread ui_thread_; 59 content::TestBrowserThread ui_thread_;
60 scoped_ptr< StrictMock<MockDriveFileSystem> > mock_file_system_; 60 scoped_ptr< StrictMock<MockFileSystem> > mock_file_system_;
61 }; 61 };
62 62
63 TEST_F(FileWriteHelperTest, PrepareFileForWritingSuccess) { 63 TEST_F(FileWriteHelperTest, PrepareFileForWritingSuccess) {
64 const base::FilePath kDrivePath(FILE_PATH_LITERAL("/drive/file.txt")); 64 const base::FilePath kDrivePath(FILE_PATH_LITERAL("/drive/file.txt"));
65 const base::FilePath kLocalPath(FILE_PATH_LITERAL("/tmp/dummy.txt")); 65 const base::FilePath kLocalPath(FILE_PATH_LITERAL("/tmp/dummy.txt"));
66 66
67 EXPECT_CALL(*mock_file_system_, CreateFile(kDrivePath, false, _)) 67 EXPECT_CALL(*mock_file_system_, CreateFile(kDrivePath, false, _))
68 .WillOnce(MockCreateFile(FILE_ERROR_OK)); 68 .WillOnce(MockCreateFile(FILE_ERROR_OK));
69 EXPECT_CALL(*mock_file_system_, OpenFile(kDrivePath, _)) 69 EXPECT_CALL(*mock_file_system_, OpenFile(kDrivePath, _))
70 .WillOnce(MockOpenFile(FILE_ERROR_OK, kLocalPath)); 70 .WillOnce(MockOpenFile(FILE_ERROR_OK, kLocalPath));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 base::FilePath path; 115 base::FilePath path;
116 file_write_helper.PrepareWritableFileAndRun( 116 file_write_helper.PrepareWritableFileAndRun(
117 kDrivePath, base::Bind(&RecordOpenFileCallbackArguments, &error, &path)); 117 kDrivePath, base::Bind(&RecordOpenFileCallbackArguments, &error, &path));
118 google_apis::test_util::RunBlockingPoolTask(); 118 google_apis::test_util::RunBlockingPoolTask();
119 119
120 EXPECT_EQ(FILE_ERROR_IN_USE, error); 120 EXPECT_EQ(FILE_ERROR_IN_USE, error);
121 EXPECT_EQ(base::FilePath(), path); 121 EXPECT_EQ(base::FilePath(), path);
122 } 122 }
123 123
124 } // namespace drive 124 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/file_system_util_unittest.cc ('k') | chrome/browser/chromeos/drive/mock_drive_file_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698