OLD | NEW |
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 #include "base/json/json_writer.h" | 5 #include "base/json/json_writer.h" |
6 #include "base/strings/string_util.h" | 6 #include "base/strings/string_util.h" |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 parameter_string, | 341 parameter_string, |
342 browser())); | 342 browser())); |
343 std::string result_string; | 343 std::string result_string; |
344 JSONWriter::Write(result.get(), &result_string); | 344 JSONWriter::Write(result.get(), &result_string); |
345 VLOG(2) << "Results: " << result_string; | 345 VLOG(2) << "Results: " << result_string; |
346 } | 346 } |
347 } | 347 } |
348 | 348 |
349 IN_PROC_BROWSER_TEST_F(WebrtcAudioPrivateTest, TriggerEvent) { | 349 IN_PROC_BROWSER_TEST_F(WebrtcAudioPrivateTest, TriggerEvent) { |
350 WebrtcAudioPrivateEventService* service = | 350 WebrtcAudioPrivateEventService* service = |
351 WebrtcAudioPrivateEventService::GetFactoryInstance()->GetForProfile( | 351 WebrtcAudioPrivateEventService::GetFactoryInstance()->Get(profile()); |
352 profile()); | |
353 | 352 |
354 // Just trigger, without any extension listening. | 353 // Just trigger, without any extension listening. |
355 service->OnDevicesChanged(base::SystemMonitor::DEVTYPE_AUDIO_CAPTURE); | 354 service->OnDevicesChanged(base::SystemMonitor::DEVTYPE_AUDIO_CAPTURE); |
356 | 355 |
357 // Now load our test extension and do it again. | 356 // Now load our test extension and do it again. |
358 const extensions::Extension* extension = LoadExtension( | 357 const extensions::Extension* extension = LoadExtension( |
359 test_data_dir_.AppendASCII("webrtc_audio_private_event_listener")); | 358 test_data_dir_.AppendASCII("webrtc_audio_private_event_listener")); |
360 service->OnDevicesChanged(base::SystemMonitor::DEVTYPE_AUDIO_CAPTURE); | 359 service->OnDevicesChanged(base::SystemMonitor::DEVTYPE_AUDIO_CAPTURE); |
361 | 360 |
362 // Check that the extension got the notification. | 361 // Check that the extension got the notification. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 ASSERT_TRUE(content::ExecuteScript(tab, "browsertestRunAllTests();")); | 402 ASSERT_TRUE(content::ExecuteScript(tab, "browsertestRunAllTests();")); |
404 | 403 |
405 content::TitleWatcher title_watcher(tab, base::ASCIIToUTF16("success")); | 404 content::TitleWatcher title_watcher(tab, base::ASCIIToUTF16("success")); |
406 title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16("failure")); | 405 title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16("failure")); |
407 base::string16 result = title_watcher.WaitAndGetTitle(); | 406 base::string16 result = title_watcher.WaitAndGetTitle(); |
408 EXPECT_EQ(base::ASCIIToUTF16("success"), result); | 407 EXPECT_EQ(base::ASCIIToUTF16("success"), result); |
409 } | 408 } |
410 #endif // defined(GOOGLE_CHROME_BUILD) || defined(ENABLE_HANGOUT_SERVICES_EXTEN
SION) | 409 #endif // defined(GOOGLE_CHROME_BUILD) || defined(ENABLE_HANGOUT_SERVICES_EXTEN
SION) |
411 | 410 |
412 } // namespace extensions | 411 } // namespace extensions |
OLD | NEW |