OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 // MediaGalleriesPrivate gallery watch API browser tests. | 5 // MediaGalleriesPrivate gallery watch API browser tests. |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 (gallery_directory_key != chrome::DIR_USER_PICTURES) && | 99 (gallery_directory_key != chrome::DIR_USER_PICTURES) && |
100 (gallery_directory_key != chrome::DIR_USER_VIDEOS)) | 100 (gallery_directory_key != chrome::DIR_USER_VIDEOS)) |
101 return false; | 101 return false; |
102 | 102 |
103 base::FilePath gallery_dir; | 103 base::FilePath gallery_dir; |
104 if (!PathService::Get(gallery_directory_key, &gallery_dir)) | 104 if (!PathService::Get(gallery_directory_key, &gallery_dir)) |
105 return false; | 105 return false; |
106 base::FilePath gallery_file = | 106 base::FilePath gallery_file = |
107 gallery_dir.Append(FILE_PATH_LITERAL("test1.txt")); | 107 gallery_dir.Append(FILE_PATH_LITERAL("test1.txt")); |
108 std::string content("new content"); | 108 std::string content("new content"); |
109 int write_size = file_util::WriteFile(gallery_file, content.c_str(), | 109 int write_size = base::WriteFile(gallery_file, content.c_str(), |
110 content.length()); | 110 content.length()); |
111 return (write_size == static_cast<int>(content.length())); | 111 return (write_size == static_cast<int>(content.length())); |
112 } | 112 } |
113 | 113 |
114 // Loads the test extension and returns the RenderViewHost of the extension. | 114 // Loads the test extension and returns the RenderViewHost of the extension. |
115 // Returns NULL if the extension load operation failed. | 115 // Returns NULL if the extension load operation failed. |
116 content::RenderViewHost* GetBackgroundHostForTestExtension() { | 116 content::RenderViewHost* GetBackgroundHostForTestExtension() { |
117 const extensions::Extension* extension = | 117 const extensions::Extension* extension = |
118 LoadExtension(test_data_dir_.AppendASCII(kTestExtensionPath)); | 118 LoadExtension(test_data_dir_.AppendASCII(kTestExtensionPath)); |
119 if (!extension) | 119 if (!extension) |
120 return NULL; | 120 return NULL; |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 // Gallery watchers does not exists. | 426 // Gallery watchers does not exists. |
427 // chrome.mediaGalleriesPrivate.getAllGalleryWatch should return an empty | 427 // chrome.mediaGalleriesPrivate.getAllGalleryWatch should return an empty |
428 // list. | 428 // list. |
429 ExtensionTestMessageListener get_all_gallery_watch_finished( | 429 ExtensionTestMessageListener get_all_gallery_watch_finished( |
430 kGetAllGalleryWatchResultA, false /* no reply */); | 430 kGetAllGalleryWatchResultA, false /* no reply */); |
431 ExecuteCmdAndCheckReply(host, kGetAllWatchedGalleryIdsCmd, | 431 ExecuteCmdAndCheckReply(host, kGetAllWatchedGalleryIdsCmd, |
432 kGetAllGalleryWatchOK); | 432 kGetAllGalleryWatchOK); |
433 EXPECT_TRUE(get_all_gallery_watch_finished.WaitUntilSatisfied()); | 433 EXPECT_TRUE(get_all_gallery_watch_finished.WaitUntilSatisfied()); |
434 } | 434 } |
435 #endif | 435 #endif |
OLD | NEW |