diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-05 03:18:42 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-05 03:18:42 +0000 |
commit | b4b3ca91faef2219ef7044bc68338b6e794703ac (patch) | |
tree | 36ef7d376370808d4cc1fb03c762bf8a60aff4ae /chrome/browser/history | |
parent | 12765d53b96eeef30653cefb2c51f5ced9b02dd1 (diff) | |
download | chromium_src-b4b3ca91faef2219ef7044bc68338b6e794703ac.zip chromium_src-b4b3ca91faef2219ef7044bc68338b6e794703ac.tar.gz chromium_src-b4b3ca91faef2219ef7044bc68338b6e794703ac.tar.bz2 |
Add a UI test to make sure that each frame of a multipart
request does not generate a separate row in the history
database.
BUG=34350
Review URL: http://codereview.chromium.org/668051
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40709 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history')
-rw-r--r-- | chrome/browser/history/multipart_uitest.cc | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/chrome/browser/history/multipart_uitest.cc b/chrome/browser/history/multipart_uitest.cc new file mode 100644 index 0000000..b1033bd --- /dev/null +++ b/chrome/browser/history/multipart_uitest.cc @@ -0,0 +1,56 @@ +// Copyright (c) 2010 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/ui/ui_test.h" + +#include "app/sql/connection.h" +#include "app/sql/statement.h" +#include "chrome/test/automation/tab_proxy.h" +#include "chrome/test/automation/browser_proxy.h" +#include "net/url_request/url_request_unittest.h" + +namespace { + +class MultipartResponseUITest : public UITest { +}; + +TEST_F(MultipartResponseUITest, SingleVisit) { + // Make sure that visiting a multipart/x-mixed-replace site only + // creates one entry in the visits table. + const wchar_t kDocRoot[] = L"chrome/test/data"; + scoped_refptr<HTTPTestServer> server = + HTTPTestServer::CreateServer(kDocRoot, NULL); + ASSERT_TRUE(NULL != server.get()); + + scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); + ASSERT_TRUE(browser_proxy.get()); + scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetActiveTab()); + ASSERT_TRUE(tab_proxy.get()); + NavigateToURL(server->TestServerPageW(L"multipart")); + std::wstring title; + EXPECT_TRUE(tab_proxy->GetTabTitle(&title)); + EXPECT_EQ(L"page 9", title); + CloseBrowserAndServer(); + + // The browser has shutdown now. Check the contents of the history + // table. We should have only one visit for the URL even though it + // had 10 parts. + sql::Connection db; + FilePath history = + user_data_dir_.AppendASCII("Default").AppendASCII("History"); + ASSERT_TRUE(file_util::PathExists(history)); + ASSERT_TRUE(db.Open(history)); + std::string query( + "SELECT COUNT(1) FROM visits, urls WHERE visits.url = urls.id" + " AND urls.url LIKE 'http://localhost:%/multipart'"); + { + sql::Statement statement(db.GetUniqueStatement(query.c_str())); + EXPECT_TRUE(statement); + EXPECT_TRUE(statement.Step()); + EXPECT_EQ(1, statement.ColumnInt(0)); + } + db.Close(); +} + +} // namespace |