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

Side by Side Diff: base/android/content_uri_utils_unittest.cc

Issue 1466413002: Update gtest to 786564fa4a3c, switch to googlemock in gtest Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/android/content_uri_utils.h" 5 #include "base/android/content_uri_utils.h"
6 #include "base/files/file_util.h" 6 #include "base/files/file_util.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/test/test_file_util.h" 8 #include "base/test/test_file_util.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/googletest/include/gtest/gtest.h"
10 10
11 namespace base { 11 namespace base {
12 namespace android { 12 namespace android {
13 13
14 TEST(ContentUriUtilsTest, ContentUriMimeTest) { 14 TEST(ContentUriUtilsTest, ContentUriMimeTest) {
15 // Get the test image path. 15 // Get the test image path.
16 FilePath data_dir; 16 FilePath data_dir;
17 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &data_dir)); 17 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &data_dir));
18 data_dir = data_dir.AppendASCII("file_util"); 18 data_dir = data_dir.AppendASCII("file_util");
19 ASSERT_TRUE(PathExists(data_dir)); 19 ASSERT_TRUE(PathExists(data_dir));
20 FilePath image_file = data_dir.Append(FILE_PATH_LITERAL("red.png")); 20 FilePath image_file = data_dir.Append(FILE_PATH_LITERAL("red.png"));
21 21
22 // Insert the image into MediaStore. MediaStore will do some conversions, and 22 // Insert the image into MediaStore. MediaStore will do some conversions, and
23 // return the content URI. 23 // return the content URI.
24 FilePath path = base::InsertImageIntoMediaStore(image_file); 24 FilePath path = base::InsertImageIntoMediaStore(image_file);
25 EXPECT_TRUE(path.IsContentUri()); 25 EXPECT_TRUE(path.IsContentUri());
26 EXPECT_TRUE(PathExists(path)); 26 EXPECT_TRUE(PathExists(path));
27 27
28 std::string mime = GetContentUriMimeType(path); 28 std::string mime = GetContentUriMimeType(path);
29 EXPECT_EQ(mime, std::string("image/png")); 29 EXPECT_EQ(mime, std::string("image/png"));
30 30
31 FilePath invalid_path("content://foo.bar"); 31 FilePath invalid_path("content://foo.bar");
32 mime = GetContentUriMimeType(invalid_path); 32 mime = GetContentUriMimeType(invalid_path);
33 EXPECT_TRUE(mime.empty()); 33 EXPECT_TRUE(mime.empty());
34 } 34 }
35 35
36 } // namespace android 36 } // namespace android
37 } // namespace base 37 } // namespace base
OLDNEW
« no previous file with comments | « base/android/application_status_listener_unittest.cc ('k') | base/android/jni_android_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698