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

Side by Side Diff: extensions/browser/api/system_storage/system_storage_eject_apitest.cc

Issue 1123783002: Add ExecuteJavaScriptForTest and make all tests use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
« no previous file with comments | « content/renderer/render_view_browsertest_mac.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // SystemStorage eject API browser tests. 5 // SystemStorage eject API browser tests.
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "components/storage_monitor/storage_info.h" 10 #include "components/storage_monitor/storage_info.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 return extensions::ProcessManager::Get(browser_context()) 52 return extensions::ProcessManager::Get(browser_context())
53 ->GetBackgroundHostForExtension(extension->id()) 53 ->GetBackgroundHostForExtension(extension->id())
54 ->render_view_host(); 54 ->render_view_host();
55 } 55 }
56 56
57 void ExecuteCmdAndCheckReply(content::RenderViewHost* host, 57 void ExecuteCmdAndCheckReply(content::RenderViewHost* host,
58 const std::string& js_command, 58 const std::string& js_command,
59 const std::string& ok_message) { 59 const std::string& ok_message) {
60 ExtensionTestMessageListener listener(ok_message, false); 60 ExtensionTestMessageListener listener(ok_message, false);
61 host->GetMainFrame()->ExecuteJavaScript(base::ASCIIToUTF16(js_command)); 61 host->GetMainFrame()->ExecuteJavaScriptForTests(
62 base::ASCIIToUTF16(js_command));
62 EXPECT_TRUE(listener.WaitUntilSatisfied()); 63 EXPECT_TRUE(listener.WaitUntilSatisfied());
63 } 64 }
64 65
65 void Attach() { 66 void Attach() {
66 DCHECK(StorageMonitor::GetInstance()->IsInitialized()); 67 DCHECK(StorageMonitor::GetInstance()->IsInitialized());
67 StorageMonitor::GetInstance()->receiver()->ProcessAttach( 68 StorageMonitor::GetInstance()->receiver()->ProcessAttach(
68 extensions::test::BuildStorageInfoFromTestStorageUnitInfo( 69 extensions::test::BuildStorageInfoFromTestStorageUnitInfo(
69 kRemovableStorageData)); 70 kRemovableStorageData));
70 content::RunAllPendingInMessageLoop(); 71 content::RunAllPendingInMessageLoop();
71 } 72 }
(...skipping 28 matching lines...) Expand all
100 EXPECT_EQ(kRemovableStorageData.device_id, monitor_->ejected_device()); 101 EXPECT_EQ(kRemovableStorageData.device_id, monitor_->ejected_device());
101 102
102 Detach(); 103 Detach();
103 } 104 }
104 105
105 IN_PROC_BROWSER_TEST_F(SystemStorageEjectApiTest, EjectBadDeviceTest) { 106 IN_PROC_BROWSER_TEST_F(SystemStorageEjectApiTest, EjectBadDeviceTest) {
106 ExecuteCmdAndCheckReply(GetHost(), "ejectFailTest()", "eject_no_such_device"); 107 ExecuteCmdAndCheckReply(GetHost(), "ejectFailTest()", "eject_no_such_device");
107 108
108 EXPECT_EQ("", monitor_->ejected_device()); 109 EXPECT_EQ("", monitor_->ejected_device());
109 } 110 }
OLDNEW
« no previous file with comments | « content/renderer/render_view_browsertest_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698