OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/drive/drive_api_util.h" | 5 #include "chrome/browser/drive/drive_api_util.h" |
6 | 6 |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/md5.h" | 8 #include "base/md5.h" |
9 #include "google_apis/drive/drive_api_parser.h" | 9 #include "google_apis/drive/drive_api_parser.h" |
10 #include "google_apis/drive/gdata_wapi_parser.h" | 10 #include "google_apis/drive/gdata_wapi_parser.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 base::ScopedTempDir temp_dir; | 157 base::ScopedTempDir temp_dir; |
158 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 158 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
159 | 159 |
160 base::FilePath path = temp_dir.path().AppendASCII("test.txt"); | 160 base::FilePath path = temp_dir.path().AppendASCII("test.txt"); |
161 const char kTestData[] = "abcdefghijklmnopqrstuvwxyz0123456789"; | 161 const char kTestData[] = "abcdefghijklmnopqrstuvwxyz0123456789"; |
162 ASSERT_TRUE(google_apis::test_util::WriteStringToFile(path, kTestData)); | 162 ASSERT_TRUE(google_apis::test_util::WriteStringToFile(path, kTestData)); |
163 | 163 |
164 EXPECT_EQ(base::MD5String(kTestData), GetMd5Digest(path)); | 164 EXPECT_EQ(base::MD5String(kTestData), GetMd5Digest(path)); |
165 } | 165 } |
166 | 166 |
| 167 TEST(DriveAPIUtilTest, HasHostedDocumentExtension) { |
| 168 EXPECT_TRUE( |
| 169 HasHostedDocumentExtension(base::FilePath::FromUTF8Unsafe("xx.gdoc"))); |
| 170 EXPECT_TRUE( |
| 171 HasHostedDocumentExtension(base::FilePath::FromUTF8Unsafe("xx.gsheet"))); |
| 172 EXPECT_TRUE( |
| 173 HasHostedDocumentExtension(base::FilePath::FromUTF8Unsafe("xx.gslides"))); |
| 174 EXPECT_TRUE( |
| 175 HasHostedDocumentExtension(base::FilePath::FromUTF8Unsafe("xx.gdraw"))); |
| 176 EXPECT_TRUE( |
| 177 HasHostedDocumentExtension(base::FilePath::FromUTF8Unsafe("xx.gtable"))); |
| 178 EXPECT_TRUE( |
| 179 HasHostedDocumentExtension(base::FilePath::FromUTF8Unsafe("xx.gform"))); |
| 180 |
| 181 EXPECT_FALSE( |
| 182 HasHostedDocumentExtension(base::FilePath::FromUTF8Unsafe("xx.gdocs"))); |
| 183 EXPECT_FALSE( |
| 184 HasHostedDocumentExtension(base::FilePath::FromUTF8Unsafe("xx.docx"))); |
| 185 EXPECT_FALSE( |
| 186 HasHostedDocumentExtension(base::FilePath::FromUTF8Unsafe("xx.jpg"))); |
| 187 } |
| 188 |
167 } // namespace util | 189 } // namespace util |
168 } // namespace drive | 190 } // namespace drive |
OLD | NEW |