OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/chromeos/gdata/gdata_files.h" | |
6 | |
7 #include "chrome/browser/chromeos/gdata/gdata.pb.h" | |
8 #include "chrome/browser/chromeos/gdata/gdata_directory_service.h" | |
9 #include "testing/gtest/include/gtest/gtest.h" | |
10 | |
11 namespace gdata { | |
12 namespace { | |
13 | |
14 const char kResumableEditMediaUrl[] = "http://resumable-edit-media/"; | |
15 | |
16 } | |
17 | |
18 TEST(GDataEntryTest, FromProto_DetectBadUploadUrl) { | |
19 GDataEntryProto proto; | |
20 proto.set_title("test.txt"); | |
21 | |
22 GDataDirectoryService directory_service; | |
23 | |
24 scoped_ptr<GDataEntry> entry(directory_service.CreateGDataFile()); | |
25 // This should fail as the upload URL is empty. | |
26 ASSERT_FALSE(entry->FromProto(proto)); | |
27 | |
28 // Set a upload URL. | |
29 proto.set_upload_url(kResumableEditMediaUrl); | |
30 | |
31 // This should succeed as the upload URL is set. | |
32 ASSERT_TRUE(entry->FromProto(proto)); | |
33 EXPECT_EQ(kResumableEditMediaUrl, entry->upload_url().spec()); | |
34 } | |
35 | |
36 } // namespace gdata | |
OLD | NEW |