OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 // MediaGalleriesPrivate eject API browser tests. | 5 // MediaGalleriesPrivate 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 "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 void ExecuteCmdAndCheckReply(content::RenderViewHost* host, | 82 void ExecuteCmdAndCheckReply(content::RenderViewHost* host, |
83 const std::string& js_command, | 83 const std::string& js_command, |
84 const std::string& ok_message) { | 84 const std::string& ok_message) { |
85 ExtensionTestMessageListener listener(ok_message, false); | 85 ExtensionTestMessageListener listener(ok_message, false); |
86 host->ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(js_command)); | 86 host->ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(js_command)); |
87 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 87 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
88 } | 88 } |
89 | 89 |
90 void Attach() { | 90 void Attach() { |
91 DCHECK(chrome::StorageMonitor::GetInstance()->IsInitialized()); | 91 DCHECK(chrome::StorageMonitor::GetInstance()->IsInitialized()); |
92 chrome::StorageInfo info(device_id_, ASCIIToUTF16(kDeviceName), kDevicePath, | 92 chrome::StorageInfo info(device_id_, kDevicePath, |
93 string16(), string16(), string16(), 0); | 93 base::ASCIIToUTF16(kDeviceName), base::string16(), |
vandebo (ex-Chrome)
2013/07/23 23:28:55
Is this to make the devices distinguishable or som
Lei Zhang
2013/07/24 05:13:34
Yes, for removable devices, the storage label fiel
| |
94 base::string16(), 0); | |
94 chrome::StorageMonitor::GetInstance()->receiver()->ProcessAttach(info); | 95 chrome::StorageMonitor::GetInstance()->receiver()->ProcessAttach(info); |
95 content::RunAllPendingInMessageLoop(); | 96 content::RunAllPendingInMessageLoop(); |
96 } | 97 } |
97 | 98 |
98 void Detach() { | 99 void Detach() { |
99 DCHECK(chrome::StorageMonitor::GetInstance()->IsInitialized()); | 100 DCHECK(chrome::StorageMonitor::GetInstance()->IsInitialized()); |
100 chrome::StorageMonitor::GetInstance()->receiver()->ProcessDetach( | 101 chrome::StorageMonitor::GetInstance()->receiver()->ProcessDetach( |
101 device_id_); | 102 device_id_); |
102 content::RunAllPendingInMessageLoop(); | 103 content::RunAllPendingInMessageLoop(); |
103 } | 104 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 EXPECT_EQ(device_id_, monitor_->ejected_device()); | 138 EXPECT_EQ(device_id_, monitor_->ejected_device()); |
138 | 139 |
139 Detach(); | 140 Detach(); |
140 } | 141 } |
141 | 142 |
142 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateEjectApiTest, EjectBadDeviceTest) { | 143 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateEjectApiTest, EjectBadDeviceTest) { |
143 ExecuteCmdAndCheckReply(GetHost(), kEjectFailTestCmd, kEjectFailListenerOk); | 144 ExecuteCmdAndCheckReply(GetHost(), kEjectFailTestCmd, kEjectFailListenerOk); |
144 | 145 |
145 EXPECT_EQ("", monitor_->ejected_device()); | 146 EXPECT_EQ("", monitor_->ejected_device()); |
146 } | 147 } |
OLD | NEW |