| 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/test_util.h" | 10 #include "google_apis/drive/test_util.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 // Empty tokens should be simply ignored. | 46 // Empty tokens should be simply ignored. |
| 47 EXPECT_EQ("", TranslateQuery("-")); | 47 EXPECT_EQ("", TranslateQuery("-")); |
| 48 EXPECT_EQ("", TranslateQuery("\"\"")); | 48 EXPECT_EQ("", TranslateQuery("\"\"")); |
| 49 EXPECT_EQ("", TranslateQuery("-\"\"")); | 49 EXPECT_EQ("", TranslateQuery("-\"\"")); |
| 50 EXPECT_EQ("", TranslateQuery("\"\"\"\"")); | 50 EXPECT_EQ("", TranslateQuery("\"\"\"\"")); |
| 51 EXPECT_EQ("", TranslateQuery("\"\" \"\"")); | 51 EXPECT_EQ("", TranslateQuery("\"\" \"\"")); |
| 52 EXPECT_EQ("fullText contains 'dog'", TranslateQuery("\"\" dog \"\"")); | 52 EXPECT_EQ("fullText contains 'dog'", TranslateQuery("\"\" dog \"\"")); |
| 53 } | 53 } |
| 54 | 54 |
| 55 TEST(FileSystemUtilTest, CanonicalizeResourceId) { | 55 TEST(DriveAPIUtilTest, CanonicalizeResourceId) { |
| 56 std::string resource_id("1YsCnrMxxgp7LDdtlFDt-WdtEIth89vA9inrILtvK-Ug"); | 56 std::string resource_id("1YsCnrMxxgp7LDdtlFDt-WdtEIth89vA9inrILtvK-Ug"); |
| 57 | 57 |
| 58 // New style ID is unchanged. | 58 // New style ID is unchanged. |
| 59 EXPECT_EQ(resource_id, CanonicalizeResourceId(resource_id)); | 59 EXPECT_EQ(resource_id, CanonicalizeResourceId(resource_id)); |
| 60 | 60 |
| 61 // Drop prefixes from old style IDs. | 61 // Drop prefixes from old style IDs. |
| 62 EXPECT_EQ(resource_id, CanonicalizeResourceId("document:" + resource_id)); | 62 EXPECT_EQ(resource_id, CanonicalizeResourceId("document:" + resource_id)); |
| 63 EXPECT_EQ(resource_id, CanonicalizeResourceId("spreadsheet:" + resource_id)); | 63 EXPECT_EQ(resource_id, CanonicalizeResourceId("spreadsheet:" + resource_id)); |
| 64 EXPECT_EQ(resource_id, CanonicalizeResourceId("presentation:" + resource_id)); | 64 EXPECT_EQ(resource_id, CanonicalizeResourceId("presentation:" + resource_id)); |
| 65 EXPECT_EQ(resource_id, CanonicalizeResourceId("drawing:" + resource_id)); | 65 EXPECT_EQ(resource_id, CanonicalizeResourceId("drawing:" + resource_id)); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 EXPECT_FALSE( | 101 EXPECT_FALSE( |
| 102 HasHostedDocumentExtension(base::FilePath::FromUTF8Unsafe("xx.docx"))); | 102 HasHostedDocumentExtension(base::FilePath::FromUTF8Unsafe("xx.docx"))); |
| 103 EXPECT_FALSE( | 103 EXPECT_FALSE( |
| 104 HasHostedDocumentExtension(base::FilePath::FromUTF8Unsafe("xx.jpg"))); | 104 HasHostedDocumentExtension(base::FilePath::FromUTF8Unsafe("xx.jpg"))); |
| 105 EXPECT_FALSE( | 105 EXPECT_FALSE( |
| 106 HasHostedDocumentExtension(base::FilePath::FromUTF8Unsafe("xx.gmap"))); | 106 HasHostedDocumentExtension(base::FilePath::FromUTF8Unsafe("xx.gmap"))); |
| 107 } | 107 } |
| 108 | 108 |
| 109 } // namespace util | 109 } // namespace util |
| 110 } // namespace drive | 110 } // namespace drive |
| OLD | NEW |