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: chrome/browser/extensions/api/media_galleries/media_galleries_watch_apitest.cc

Issue 1257603003: Revert of Add ExecuteJavaScriptForTest and make all tests use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months 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 // MediaGalleries gallery watch API browser tests. 5 // MediaGalleries gallery watch API browser tests.
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/file_path_watcher.h" 8 #include "base/files/file_path_watcher.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 ExtensionApiTest::TearDownOnMainThread(); 101 ExtensionApiTest::TearDownOnMainThread();
102 } 102 }
103 103
104 bool GalleryWatchesSupported() { 104 bool GalleryWatchesSupported() {
105 return base::FilePathWatcher::RecursiveWatchAvailable(); 105 return base::FilePathWatcher::RecursiveWatchAvailable();
106 } 106 }
107 107
108 void ExecuteCmdAndCheckReply(const std::string& js_command, 108 void ExecuteCmdAndCheckReply(const std::string& js_command,
109 const std::string& ok_message) { 109 const std::string& ok_message) {
110 ExtensionTestMessageListener listener(ok_message, false); 110 ExtensionTestMessageListener listener(ok_message, false);
111 background_host_->GetMainFrame()->ExecuteJavaScriptForTests( 111 background_host_->GetMainFrame()->ExecuteJavaScript(
112 base::ASCIIToUTF16(js_command)); 112 base::ASCIIToUTF16(js_command));
113 EXPECT_TRUE(listener.WaitUntilSatisfied()); 113 EXPECT_TRUE(listener.WaitUntilSatisfied());
114 } 114 }
115 115
116 bool AddNewFileInTestGallery() { 116 bool AddNewFileInTestGallery() {
117 base::FilePath gallery_file = 117 base::FilePath gallery_file =
118 test_gallery_.path().Append(FILE_PATH_LITERAL("test1.txt")); 118 test_gallery_.path().Append(FILE_PATH_LITERAL("test1.txt"));
119 std::string content("new content"); 119 std::string content("new content");
120 int write_size = 120 int write_size =
121 base::WriteFile(gallery_file, content.c_str(), content.length()); 121 base::WriteFile(gallery_file, content.c_str(), content.length());
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 // Remove all gallery watchers. 351 // Remove all gallery watchers.
352 ExecuteCmdAndCheckReply(kRemoveAllGalleryWatchCmd, kRemoveAllGalleryWatchOK); 352 ExecuteCmdAndCheckReply(kRemoveAllGalleryWatchCmd, kRemoveAllGalleryWatchOK);
353 353
354 // Gallery watchers removed. chrome.mediaGalleries.getAllGalleryWatch 354 // Gallery watchers removed. chrome.mediaGalleries.getAllGalleryWatch
355 // should return an empty list. 355 // should return an empty list.
356 ExtensionTestMessageListener final_get_all_check_finished( 356 ExtensionTestMessageListener final_get_all_check_finished(
357 kNoGalleryWatchesInstalled, false /* no reply */); 357 kNoGalleryWatchesInstalled, false /* no reply */);
358 ExecuteCmdAndCheckReply(kGetAllWatchedGalleryIdsCmd, kGetAllGalleryWatchOK); 358 ExecuteCmdAndCheckReply(kGetAllWatchedGalleryIdsCmd, kGetAllGalleryWatchOK);
359 EXPECT_TRUE(final_get_all_check_finished.WaitUntilSatisfied()); 359 EXPECT_TRUE(final_get_all_check_finished.WaitUntilSatisfied());
360 } 360 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/alert_apitest.cc ('k') | chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698