Commit 1ad1e820 authored by vandebo@chromium.org's avatar vandebo@chromium.org

Add a test for ITunesDataProvider (try two).

It's a browser test instead of a unit test because the utility process gets invoked.
Patch set one is what was reviewed and committed in https://codereview.chromium.org/17616006/

BUG=NONE

Review URL: https://chromiumcodereview.appspot.com/18348019

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212384 0039d316-1c4b-4281-b951-d872f2087c98
parent 09bcf8ea
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
namespace itunes { namespace itunes {
class TestITunesDataProvider;
// This class is the holder for iTunes parsed data. Given a path to the iTunes // This class is the holder for iTunes parsed data. Given a path to the iTunes
// library XML file it will read it in, parse the data, and provide convenient // library XML file it will read it in, parse the data, and provide convenient
// methods to access it. When the file changes, it will update the data. // methods to access it. When the file changes, it will update the data.
...@@ -30,7 +32,7 @@ class ITunesDataProvider { ...@@ -30,7 +32,7 @@ class ITunesDataProvider {
typedef base::Callback<void(bool)> ReadyCallback; typedef base::Callback<void(bool)> ReadyCallback;
explicit ITunesDataProvider(const base::FilePath& library_path); explicit ITunesDataProvider(const base::FilePath& library_path);
~ITunesDataProvider(); virtual ~ITunesDataProvider();
// Ask the data provider to refresh the data if necessary. |ready_callback| // Ask the data provider to refresh the data if necessary. |ready_callback|
// will be called with the result; false if unable to parse the XML file. // will be called with the result; false if unable to parse the XML file.
...@@ -61,6 +63,8 @@ class ITunesDataProvider { ...@@ -61,6 +63,8 @@ class ITunesDataProvider {
Album GetAlbum(const ArtistName& artist, const AlbumName& album) const; Album GetAlbum(const ArtistName& artist, const AlbumName& album) const;
private: private:
friend class TestITunesDataProvider;
typedef std::map<AlbumName, Album> Artist; typedef std::map<AlbumName, Album> Artist;
typedef std::map<ArtistName, Artist> Library; typedef std::map<ArtistName, Artist> Library;
...@@ -79,8 +83,8 @@ class ITunesDataProvider { ...@@ -79,8 +83,8 @@ class ITunesDataProvider {
// watch. // watch.
void OnLibraryWatchStarted(scoped_ptr<base::FilePathWatcher> library_watcher); void OnLibraryWatchStarted(scoped_ptr<base::FilePathWatcher> library_watcher);
// Called when |library_path_| has changed. // Called when |library_path_| has changed. Virtual for testing.
void OnLibraryChanged(const base::FilePath& path, bool error); virtual void OnLibraryChanged(const base::FilePath& path, bool error);
// Called when the utility process finishes parsing the library XML file. // Called when the utility process finishes parsing the library XML file.
void OnLibraryParsed(const ReadyCallback& ready_callback, void OnLibraryParsed(const ReadyCallback& ready_callback,
......
...@@ -38,6 +38,8 @@ class ITunesFinderWinTest : public InProcessBrowserTest { ...@@ -38,6 +38,8 @@ class ITunesFinderWinTest : public InProcessBrowserTest {
public: public:
ITunesFinderWinTest() : test_finder_callback_called_(false) {} ITunesFinderWinTest() : test_finder_callback_called_(false) {}
virtual ~ITunesFinderWinTest() {}
virtual void SetUp() OVERRIDE { virtual void SetUp() OVERRIDE {
ASSERT_TRUE(app_data_dir_.CreateUniqueTempDir()); ASSERT_TRUE(app_data_dir_.CreateUniqueTempDir());
ASSERT_TRUE(music_dir_.CreateUniqueTempDir()); ASSERT_TRUE(music_dir_.CreateUniqueTempDir());
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
namespace itunes { namespace itunes {
class ITunesDataProvider; class ITunesDataProvider;
class ITunesDataProviderTest;
} }
namespace picasa { namespace picasa {
...@@ -49,6 +50,7 @@ class ImportedMediaGalleryRegistry { ...@@ -49,6 +50,7 @@ class ImportedMediaGalleryRegistry {
private: private:
friend struct base::DefaultLazyInstanceTraits<ImportedMediaGalleryRegistry>; friend struct base::DefaultLazyInstanceTraits<ImportedMediaGalleryRegistry>;
friend class itunes::ITunesDataProviderTest;
ImportedMediaGalleryRegistry(); ImportedMediaGalleryRegistry();
virtual ~ImportedMediaGalleryRegistry(); virtual ~ImportedMediaGalleryRegistry();
......
...@@ -2016,6 +2016,11 @@ ...@@ -2016,6 +2016,11 @@
'browser/printing/cloud_print/test/cloud_print_policy_browsertest.cc', 'browser/printing/cloud_print/test/cloud_print_policy_browsertest.cc',
], ],
}], }],
['OS=="mac" or OS=="win"', {
'sources': [
'browser/media_galleries/fileapi/itunes_data_provider_browsertest.cc',
],
}],
['os_posix == 0 or chromeos == 1', { ['os_posix == 0 or chromeos == 1', {
'sources!': [ 'sources!': [
'common/time_format_browsertest.cc', 'common/time_format_browsertest.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment