| 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 RunComponentExtensionTest) { | 389 RunComponentExtensionTest) { |
| 390 // This runs the end-to-end JavaScript test for the Hangout Services | 390 // This runs the end-to-end JavaScript test for the Hangout Services |
| 391 // component extension, which uses the webrtcAudioPrivate API among | 391 // component extension, which uses the webrtcAudioPrivate API among |
| 392 // others. | 392 // others. |
| 393 ASSERT_TRUE(StartEmbeddedTestServer()); | 393 ASSERT_TRUE(StartEmbeddedTestServer()); |
| 394 GURL url(embedded_test_server()->GetURL( | 394 GURL url(embedded_test_server()->GetURL( |
| 395 "/extensions/hangout_services_test.html")); | 395 "/extensions/hangout_services_test.html")); |
| 396 // The "externally connectable" extension permission doesn't seem to | 396 // The "externally connectable" extension permission doesn't seem to |
| 397 // like when we use 127.0.0.1 as the host, but using localhost works. | 397 // like when we use 127.0.0.1 as the host, but using localhost works. |
| 398 std::string url_spec = url.spec(); | 398 std::string url_spec = url.spec(); |
| 399 ReplaceFirstSubstringAfterOffset(&url_spec, 0, "127.0.0.1", "localhost"); | 399 base::ReplaceFirstSubstringAfterOffset( |
| 400 &url_spec, 0, "127.0.0.1", "localhost"); |
| 400 GURL localhost_url(url_spec); | 401 GURL localhost_url(url_spec); |
| 401 ui_test_utils::NavigateToURL(browser(), localhost_url); | 402 ui_test_utils::NavigateToURL(browser(), localhost_url); |
| 402 | 403 |
| 403 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 404 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 404 WaitUntilAudioIsPlaying(tab); | 405 WaitUntilAudioIsPlaying(tab); |
| 405 | 406 |
| 406 // Override, i.e. disable, uploading. We don't want to try sending data to | 407 // Override, i.e. disable, uploading. We don't want to try sending data to |
| 407 // servers when running the test. We don't bother about the contents of the | 408 // servers when running the test. We don't bother about the contents of the |
| 408 // buffer |dummy|, that's tested in other tests. | 409 // buffer |dummy|, that's tested in other tests. |
| 409 std::string dummy; | 410 std::string dummy; |
| 410 g_browser_process->webrtc_log_uploader()-> | 411 g_browser_process->webrtc_log_uploader()-> |
| 411 OverrideUploadWithBufferForTesting(&dummy); | 412 OverrideUploadWithBufferForTesting(&dummy); |
| 412 | 413 |
| 413 ASSERT_TRUE(content::ExecuteScript(tab, "browsertestRunAllTests();")); | 414 ASSERT_TRUE(content::ExecuteScript(tab, "browsertestRunAllTests();")); |
| 414 | 415 |
| 415 content::TitleWatcher title_watcher(tab, base::ASCIIToUTF16("success")); | 416 content::TitleWatcher title_watcher(tab, base::ASCIIToUTF16("success")); |
| 416 title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16("failure")); | 417 title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16("failure")); |
| 417 base::string16 result = title_watcher.WaitAndGetTitle(); | 418 base::string16 result = title_watcher.WaitAndGetTitle(); |
| 418 EXPECT_EQ(base::ASCIIToUTF16("success"), result); | 419 EXPECT_EQ(base::ASCIIToUTF16("success"), result); |
| 419 | 420 |
| 420 g_browser_process->webrtc_log_uploader()->OverrideUploadWithBufferForTesting( | 421 g_browser_process->webrtc_log_uploader()->OverrideUploadWithBufferForTesting( |
| 421 NULL); | 422 NULL); |
| 422 } | 423 } |
| 423 #endif // defined(GOOGLE_CHROME_BUILD) || defined(ENABLE_HANGOUT_SERVICES_EXTEN
SION) | 424 #endif // defined(GOOGLE_CHROME_BUILD) || defined(ENABLE_HANGOUT_SERVICES_EXTEN
SION) |
| 424 | 425 |
| 425 } // namespace extensions | 426 } // namespace extensions |
| OLD | NEW |