Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4031)

Unified Diff: chrome/browser/net/load_timing_observer_uitest.cc

Issue 8336012: Fix bug where Navigation Timing reports negative load time when redirecting to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Win build Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/net/load_timing_observer.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/load_timing_observer_uitest.cc
diff --git a/chrome/browser/net/load_timing_observer_uitest.cc b/chrome/browser/net/load_timing_observer_uitest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2127baff9a6d1560c4891d5b46c057197f212d93
--- /dev/null
+++ b/chrome/browser/net/load_timing_observer_uitest.cc
@@ -0,0 +1,40 @@
+// Copyright (c) 2011 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/test/automation/tab_proxy.h"
+#include "chrome/test/ui/ui_test.h"
+#include "googleurl/src/gurl.h"
+#include "net/test/test_server.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+class LoadTimingObserverUITest : public UITest {
+ public:
+ LoadTimingObserverUITest()
+ : http_server_(net::TestServer::TYPE_HTTP, FilePath()) {
+ dom_automation_enabled_ = true;
+ }
+
+ protected:
+ net::TestServer http_server_;
+};
+
+TEST_F(LoadTimingObserverUITest, CacheHitAfterRedirect) {
+ ASSERT_TRUE(http_server_.Start());
+ GURL cached_page = http_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();
+ int response_start = 0;
+ int response_end = 0;
+ ASSERT_TRUE(tab_proxy->ExecuteAndExtractInt(
+ 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("
+ L"window.performance.timing.responseEnd - "
+ L"window.performance.timing.navigationStart)", &response_end));
+ EXPECT_LE(response_start, response_end);
+}
« no previous file with comments | « chrome/browser/net/load_timing_observer.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698