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

Side by Side Diff: chrome/browser/history/multipart_uitest.cc

Issue 6312154: Remove wstring from RVH's run Javascript command.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/test/ui/ui_test.h" 5 #include "chrome/test/ui/ui_test.h"
6 6
7 #include "app/sql/connection.h" 7 #include "app/sql/connection.h"
8 #include "app/sql/statement.h" 8 #include "app/sql/statement.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/utf_string_conversions.h"
10 #include "chrome/test/automation/tab_proxy.h" 11 #include "chrome/test/automation/tab_proxy.h"
11 #include "chrome/test/automation/browser_proxy.h" 12 #include "chrome/test/automation/browser_proxy.h"
12 #include "net/test/test_server.h" 13 #include "net/test/test_server.h"
13 14
14 namespace { 15 namespace {
15 16
16 class MultipartResponseUITest : public UITest { 17 class MultipartResponseUITest : public UITest {
17 }; 18 };
18 19
19 #if defined(NDEBUG) 20 #if defined(NDEBUG)
20 // http://code.google.com/p/chromium/issues/detail?id=37746 21 // http://code.google.com/p/chromium/issues/detail?id=37746
21 // Running this test only for release builds as it fails in debug test 22 // Running this test only for release builds as it fails in debug test
22 // runs 23 // runs
23 TEST_F(MultipartResponseUITest, SingleVisit) { 24 TEST_F(MultipartResponseUITest, SingleVisit) {
24 // Make sure that visiting a multipart/x-mixed-replace site only 25 // Make sure that visiting a multipart/x-mixed-replace site only
25 // creates one entry in the visits table. 26 // creates one entry in the visits table.
26 net::TestServer test_server(net::TestServer::TYPE_HTTP, 27 net::TestServer test_server(net::TestServer::TYPE_HTTP,
27 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); 28 FilePath(FILE_PATH_LITERAL("chrome/test/data")));
28 ASSERT_TRUE(test_server.Start()); 29 ASSERT_TRUE(test_server.Start());
29 30
30 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); 31 scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
31 ASSERT_TRUE(browser_proxy.get()); 32 ASSERT_TRUE(browser_proxy.get());
32 scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetActiveTab()); 33 scoped_refptr<TabProxy> tab_proxy(browser_proxy->GetActiveTab());
33 ASSERT_TRUE(tab_proxy.get()); 34 ASSERT_TRUE(tab_proxy.get());
34 NavigateToURL(test_server.GetURL("multipart")); 35 NavigateToURL(test_server.GetURL("multipart"));
35 std::wstring title; 36 string16 title;
36 EXPECT_TRUE(tab_proxy->GetTabTitle(&title)); 37 EXPECT_TRUE(tab_proxy->GetTabTitle(&title));
37 EXPECT_EQ(L"page 9", title); 38 EXPECT_EQ(ASCIIToUTF16("page 9"), title);
38 CloseBrowserAndServer(); 39 CloseBrowserAndServer();
39 40
40 // The browser has shutdown now. Check the contents of the history 41 // The browser has shutdown now. Check the contents of the history
41 // table. We should have only one visit for the URL even though it 42 // table. We should have only one visit for the URL even though it
42 // had 10 parts. 43 // had 10 parts.
43 sql::Connection db; 44 sql::Connection db;
44 FilePath history = 45 FilePath history =
45 user_data_dir().AppendASCII("Default").AppendASCII("History"); 46 user_data_dir().AppendASCII("Default").AppendASCII("History");
46 ASSERT_TRUE(file_util::PathExists(history)); 47 ASSERT_TRUE(file_util::PathExists(history));
47 ASSERT_TRUE(db.Open(history)); 48 ASSERT_TRUE(db.Open(history));
48 std::string query( 49 std::string query(
49 "SELECT COUNT(1) FROM visits, urls WHERE visits.url = urls.id" 50 "SELECT COUNT(1) FROM visits, urls WHERE visits.url = urls.id"
50 " AND urls.url LIKE 'http://" + 51 " AND urls.url LIKE 'http://" +
51 test_server.host_port_pair().HostForURL() + ":%/multipart'"); 52 test_server.host_port_pair().HostForURL() + ":%/multipart'");
52 { 53 {
53 sql::Statement statement(db.GetUniqueStatement(query.c_str())); 54 sql::Statement statement(db.GetUniqueStatement(query.c_str()));
54 EXPECT_TRUE(statement); 55 EXPECT_TRUE(statement);
55 EXPECT_TRUE(statement.Step()); 56 EXPECT_TRUE(statement.Step());
56 EXPECT_EQ(1, statement.ColumnInt(0)); 57 EXPECT_EQ(1, statement.ColumnInt(0));
57 } 58 }
58 db.Close(); 59 db.Close();
59 } 60 }
60 #endif 61 #endif
61 62
62 } // namespace 63 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698