blob: cea21c5599772b07a6932e301a1b149a3c71e22f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_tabstrip.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 "content/public/test/browser_test_utils.h"
#include "googleurl/src/gurl.h"
#include "net/test/test_server.h"
class LoadTimingObserverTest : public InProcessBrowserTest {
public:
LoadTimingObserverTest() {}
};
// http://crbug.com/102030
IN_PROC_BROWSER_TEST_F(LoadTimingObserverTest, FLAKY_CacheHitAfterRedirect) {
ASSERT_TRUE(test_server()->Start());
GURL cached_page = test_server()->GetURL("cachetime");
std::string redirect = "server-redirect?" + cached_page.spec();
ui_test_utils::NavigateToURL(browser(), cached_page);
ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(redirect));
int response_start = 0;
int response_end = 0;
content::RenderViewHost* render_view_host =
chrome::GetActiveWebContents(browser())->GetRenderViewHost();
ASSERT_TRUE(content::ExecuteJavaScriptAndExtractInt(
render_view_host, L"",
L"window.domAutomationController.send("
L"window.performance.timing.responseStart - "
L"window.performance.timing.navigationStart)", &response_start));
ASSERT_TRUE(content::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);
}
|