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

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

Issue 739033003: Support content scheme uri for Chrome on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 6 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/android/content_uri_utils.h"
6 #include "base/files/file_util.h"
7 #include "base/path_service.h"
8 #include "base/test/test_file_util.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 namespace base {
12 namespace android {
13
14 TEST(ContentUriUtilsTest, ContentUriMimeTest) {
15 // Get the test image path.
16 FilePath data_dir;
17 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &data_dir));
18 data_dir = data_dir.AppendASCII("file_util");
19 ASSERT_TRUE(PathExists(data_dir));
20 FilePath image_file = data_dir.Append(FILE_PATH_LITERAL("red.png"));
21
22 // Insert the image into MediaStore. MediaStore will do some conversions, and
23 // return the content URI.
24 FilePath path = base::InsertImageIntoMediaStore(image_file);
25 EXPECT_TRUE(path.IsContentUri());
26 EXPECT_TRUE(PathExists(path));
27
28 std::string mime = GetContentUriMimeType(path);
29 EXPECT_EQ(mime, std::string("image/png"));
30
31 FilePath invalid_path("content://foo.bar");
32 mime = GetContentUriMimeType(invalid_path);
33 EXPECT_TRUE(mime.empty());
34 }
35
36 } // namespace android
37 } // namespace base
OLDNEW
« no previous file with comments | « base/android/content_uri_utils.cc ('k') | base/android/java/src/org/chromium/base/ContentUriUtils.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698