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

Side by Side Diff: chrome/browser/media_gallery/media_galleries_test_util.cc

Issue 11027051: MediaFileSystemRegistry unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile Created 8 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 | Annotate | Revision Log
OLDNEW
(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/media_gallery/media_galleries_test_util.h"
6
7 #include "chrome/common/chrome_paths.h"
Lei Zhang 2012/11/09 09:14:53 alphabetical order
vandebo (ex-Chrome) 2012/11/13 06:50:18 Done.
8 #include "base/file_path.h"
9 #include "base/file_util.h"
10 #include "base/path_service.h"
11 #include "base/stringprintf.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 EnsureMediaDirectoriesExists::EnsureMediaDirectoriesExists()
15 : num_galleries_(0) {
16 Init();
17 }
18
19 void EnsureMediaDirectoriesExists::Init() {
20 #if defined(OS_CHROMEOS) || defined(OS_ANDROID)
21 return;
22 #else
23 ASSERT_TRUE(fake_dir_.CreateUniqueTempDir());
24
25 const int kDirectoryKeys[] = {
26 chrome::DIR_USER_MUSIC,
27 chrome::DIR_USER_PICTURES,
28 chrome::DIR_USER_VIDEOS,
29 };
30
31 const char* kDirectoryNames[] = {
32 "music",
33 "pictures",
34 "videos",
35 };
36
37 for (size_t i = 0; i < arraysize(kDirectoryKeys); ++i) {
38 PathService::OverrideAndCreateIfNeeded(
39 kDirectoryKeys[i],
40 fake_dir_.path().Append(FILE_PATH_LITERAL(kDirectoryNames[i])),
Lei Zhang 2012/11/09 09:14:53 Just AppendASCII() ?
vandebo (ex-Chrome) 2012/11/13 06:50:18 Done.
41 true /*create*/);
42 FilePath path;
43 if (PathService::Get(kDirectoryKeys[i], &path) &&
44 file_util::DirectoryExists(path)) {
45 ++num_galleries_;
46 }
47 }
48 ASSERT_GT(num_galleries_, 0);
49 #endif
50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698