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

Side by Side Diff: chrome/browser/in_process_webkit/indexed_db_browsertest.cc

Issue 4682002: Remove "name" field from indexed databases. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years, 1 month 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/ref_counted.h" 7 #include "base/ref_counted.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/browser.h" 9 #include "chrome/browser/browser.h"
10 #include "chrome/browser/in_process_webkit/indexed_db_context.h"
11 #include "chrome/browser/tab_contents/tab_contents.h" 10 #include "chrome/browser/tab_contents/tab_contents.h"
12 #include "chrome/common/chrome_switches.h" 11 #include "chrome/common/chrome_switches.h"
13 #include "chrome/test/in_process_browser_test.h" 12 #include "chrome/test/in_process_browser_test.h"
14 #include "chrome/test/thread_test_helper.h"
15 #include "chrome/test/ui_test_utils.h" 13 #include "chrome/test/ui_test_utils.h"
16 #include "third_party/WebKit/WebKit/chromium/public/WebCString.h"
17 #include "third_party/WebKit/WebKit/chromium/public/WebSecurityOrigin.h"
18 #include "third_party/WebKit/WebKit/chromium/public/WebString.h"
19
20 namespace {
21
22 const FilePath kTestIndexedDBFile(
23 FILE_PATH_LITERAL("http_host_1@database%20name.indexeddb"));
24
25 class TestOnWebKitThread : public ThreadTestHelper {
26 public:
27 TestOnWebKitThread()
28 : ThreadTestHelper(BrowserThread::WEBKIT) {
29 }
30
31 const std::string& database_name() const { return database_name_; }
32 const WebKit::WebSecurityOrigin& security_origin() const {
33 return security_origin_;
34 }
35
36 private:
37 virtual ~TestOnWebKitThread() {}
38
39 virtual void RunTest() {
40 set_test_result(IndexedDBContext::SplitIndexedDBFileName(
41 kTestIndexedDBFile, &database_name_, &security_origin_));
42 }
43
44 std::string database_name_;
45 WebKit::WebSecurityOrigin security_origin_;
46
47 DISALLOW_COPY_AND_ASSIGN(TestOnWebKitThread);
48 };
49
50 } // namespace
51 14
52 // This browser test is aimed towards exercising the IndexedDB bindings and 15 // This browser test is aimed towards exercising the IndexedDB bindings and
53 // the actual implementation that lives in the browser side (in_process_webkit). 16 // the actual implementation that lives in the browser side (in_process_webkit).
54 class IndexedDBBrowserTest : public InProcessBrowserTest { 17 class IndexedDBBrowserTest : public InProcessBrowserTest {
55 public: 18 public:
56 IndexedDBBrowserTest() { 19 IndexedDBBrowserTest() {
57 EnableDOMAutomation(); 20 EnableDOMAutomation();
58 } 21 }
59 22
60 GURL testUrl(const FilePath& file_path) { 23 GURL testUrl(const FilePath& file_path) {
(...skipping 10 matching lines...) Expand all
71 if (result != "pass") { 34 if (result != "pass") {
72 std::string js_result; 35 std::string js_result;
73 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( 36 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString(
74 browser()->GetSelectedTabContents()->render_view_host(), L"", 37 browser()->GetSelectedTabContents()->render_view_host(), L"",
75 L"window.domAutomationController.send(getLog())", &js_result)); 38 L"window.domAutomationController.send(getLog())", &js_result));
76 FAIL() << "Failed: " << js_result; 39 FAIL() << "Failed: " << js_result;
77 } 40 }
78 } 41 }
79 }; 42 };
80 43
81 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, SplitFilename) {
82 scoped_refptr<TestOnWebKitThread> test_on_webkit_thread(
83 new TestOnWebKitThread);
84 ASSERT_TRUE(test_on_webkit_thread->Run());
85
86 EXPECT_EQ("database name", test_on_webkit_thread->database_name());
87 std::string origin_str =
88 test_on_webkit_thread->security_origin().toString().utf8();
89 EXPECT_EQ("http://host:1", origin_str);
90 }
91
92 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CursorTest) { 44 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CursorTest) {
93 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("cursor_test.html")))); 45 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("cursor_test.html"))));
94 } 46 }
95 47
96 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, IndexTest) { 48 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, IndexTest) {
97 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("index_test.html")))); 49 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("index_test.html"))));
98 } 50 }
99 51
100 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, KeyPathTest) { 52 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, KeyPathTest) {
101 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("key_path_test.html")))); 53 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("key_path_test.html"))));
102 } 54 }
103 55
104 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, TransactionGetTest) { 56 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, TransactionGetTest) {
105 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("transaction_get_test.html")))); 57 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("transaction_get_test.html"))));
106 } 58 }
107 59
108 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, ObjectStoreTest) { 60 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, ObjectStoreTest) {
109 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("object_store_test.html")))); 61 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("object_store_test.html"))));
110 } 62 }
111 63
112 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DatabaseTest) { 64 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DatabaseTest) {
113 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("database_test.html")))); 65 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("database_test.html"))));
114 } 66 }
115 67
116 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, TransactionTest) { 68 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, TransactionTest) {
117 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("transaction_test.html")))); 69 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("transaction_test.html"))));
118 } 70 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/options/cookies_view_unittest.cc ('k') | chrome/browser/in_process_webkit/indexed_db_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698