| Index: chrome/browser/net/load_timing_observer_browsertest.cc
|
| ===================================================================
|
| --- chrome/browser/net/load_timing_observer_browsertest.cc (revision 131202)
|
| +++ chrome/browser/net/load_timing_observer_browsertest.cc (working copy)
|
| @@ -2,42 +2,42 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chrome/test/automation/tab_proxy.h"
|
| -#include "chrome/test/ui/ui_test.h"
|
| +#include "chrome/browser/ui/browser.h"
|
| +#include "chrome/test/base/in_process_browser_test.h"
|
| +#include "chrome/test/base/ui_test_utils.h"
|
| +#include "content/public/browser/web_contents.h"
|
| #include "googleurl/src/gurl.h"
|
| #include "net/test/test_server.h"
|
| -#include "testing/gtest/include/gtest/gtest.h"
|
|
|
| -class LoadTimingObserverUITest : public UITest {
|
| +class LoadTimingObserverTest : public InProcessBrowserTest {
|
| public:
|
| - LoadTimingObserverUITest()
|
| - : http_server_(net::TestServer::TYPE_HTTP,
|
| - net::TestServer::kLocalhost,
|
| - FilePath()) {
|
| - dom_automation_enabled_ = true;
|
| + LoadTimingObserverTest() {
|
| + EnableDOMAutomation();
|
| }
|
|
|
| protected:
|
| - net::TestServer http_server_;
|
| };
|
|
|
| // http://crbug.com/102030
|
| -// http://crbug.com/114390
|
| -TEST_F(LoadTimingObserverUITest, DISABLED_CacheHitAfterRedirect) {
|
| - ASSERT_TRUE(http_server_.Start());
|
| - GURL cached_page = http_server_.GetURL("cachetime");
|
| +IN_PROC_BROWSER_TEST_F(LoadTimingObserverTest, CacheHitAfterRedirect) {
|
| + ASSERT_TRUE(test_server()->Start());
|
| + GURL cached_page = test_server()->GetURL("cachetime");
|
| std::string redirect = "server-redirect?" + cached_page.spec();
|
| - NavigateToURL(cached_page);
|
| - NavigateToURL(http_server_.GetURL(redirect));
|
| - scoped_refptr<TabProxy> tab_proxy = GetActiveTab();
|
| + ui_test_utils::NavigateToURL(browser(), cached_page);
|
| + ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(redirect));
|
| +
|
| int response_start = 0;
|
| int response_end = 0;
|
| - ASSERT_TRUE(tab_proxy->ExecuteAndExtractInt(
|
| - L"", L"window.domAutomationController.send("
|
| + content::RenderViewHost* render_view_host =
|
| + browser()->GetSelectedWebContents()->GetRenderViewHost();
|
| + ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractInt(
|
| + render_view_host, L"",
|
| + L"window.domAutomationController.send("
|
| L"window.performance.timing.responseStart - "
|
| L"window.performance.timing.navigationStart)", &response_start));
|
| - ASSERT_TRUE(tab_proxy->ExecuteAndExtractInt(
|
| - L"", L"window.domAutomationController.send("
|
| + ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractInt(
|
| + render_view_host, L"",
|
| + L"window.domAutomationController.send("
|
| L"window.performance.timing.responseEnd - "
|
| L"window.performance.timing.navigationStart)", &response_end));
|
| EXPECT_LE(response_start, response_end);
|
|
|