OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/scoped_temp_dir.h" | 11 #include "base/scoped_temp_dir.h" |
12 #include "base/test/thread_test_helper.h" | 12 #include "base/test/thread_test_helper.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/browser_tabstrip.h" |
15 #include "chrome/test/base/in_process_browser_test.h" | 16 #include "chrome/test/base/in_process_browser_test.h" |
16 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
17 #include "chrome/test/base/ui_test_utils.h" | 18 #include "chrome/test/base/ui_test_utils.h" |
18 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" | 19 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" |
19 #include "content/browser/web_contents/web_contents_impl.h" | 20 #include "content/browser/web_contents/web_contents_impl.h" |
20 #include "content/public/common/content_paths.h" | 21 #include "content/public/common/content_paths.h" |
21 #include "content/public/common/content_switches.h" | 22 #include "content/public/common/content_switches.h" |
22 #include "net/base/net_util.h" | 23 #include "net/base/net_util.h" |
23 #include "webkit/database/database_util.h" | 24 #include "webkit/database/database_util.h" |
24 #include "webkit/quota/mock_special_storage_policy.h" | 25 #include "webkit/quota/mock_special_storage_policy.h" |
(...skipping 22 matching lines...) Expand all Loading... |
47 | 48 |
48 void SimpleTest(const GURL& test_url, bool incognito = false) { | 49 void SimpleTest(const GURL& test_url, bool incognito = false) { |
49 // The test page will perform tests on IndexedDB, then navigate to either | 50 // The test page will perform tests on IndexedDB, then navigate to either |
50 // a #pass or #fail ref. | 51 // a #pass or #fail ref. |
51 Browser* the_browser = incognito ? CreateIncognitoBrowser() : browser(); | 52 Browser* the_browser = incognito ? CreateIncognitoBrowser() : browser(); |
52 | 53 |
53 LOG(INFO) << "Navigating to URL and blocking."; | 54 LOG(INFO) << "Navigating to URL and blocking."; |
54 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( | 55 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
55 the_browser, test_url, 2); | 56 the_browser, test_url, 2); |
56 LOG(INFO) << "Navigation done."; | 57 LOG(INFO) << "Navigation done."; |
57 std::string result = the_browser->GetActiveWebContents()->GetURL().ref(); | 58 std::string result = |
| 59 chrome::GetActiveWebContents(the_browser)->GetURL().ref(); |
58 if (result != "pass") { | 60 if (result != "pass") { |
59 std::string js_result; | 61 std::string js_result; |
60 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( | 62 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( |
61 the_browser->GetActiveWebContents()->GetRenderViewHost(), L"", | 63 chrome::GetActiveWebContents(the_browser)->GetRenderViewHost(), L"", |
62 L"window.domAutomationController.send(getLog())", &js_result)); | 64 L"window.domAutomationController.send(getLog())", &js_result)); |
63 FAIL() << "Failed: " << js_result; | 65 FAIL() << "Failed: " << js_result; |
64 } | 66 } |
65 } | 67 } |
66 }; | 68 }; |
67 | 69 |
68 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CursorTest) { | 70 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CursorTest) { |
69 SimpleTest(GetTestURL(FilePath(FILE_PATH_LITERAL("cursor_test.html")))); | 71 SimpleTest(GetTestURL(FilePath(FILE_PATH_LITERAL("cursor_test.html")))); |
70 } | 72 } |
71 | 73 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 } | 110 } |
109 | 111 |
110 // Appears flaky/slow, see: http://crbug.com/120298 | 112 // Appears flaky/slow, see: http://crbug.com/120298 |
111 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DISABLED_ValueSizeTest) { | 113 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DISABLED_ValueSizeTest) { |
112 SimpleTest(GetTestURL(FilePath(FILE_PATH_LITERAL("value_size_test.html")))); | 114 SimpleTest(GetTestURL(FilePath(FILE_PATH_LITERAL("value_size_test.html")))); |
113 } | 115 } |
114 | 116 |
115 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DoesntHangTest) { | 117 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DoesntHangTest) { |
116 SimpleTest(GetTestURL(FilePath( | 118 SimpleTest(GetTestURL(FilePath( |
117 FILE_PATH_LITERAL("transaction_run_forever.html")))); | 119 FILE_PATH_LITERAL("transaction_run_forever.html")))); |
118 ui_test_utils::CrashTab(browser()->GetActiveWebContents()); | 120 ui_test_utils::CrashTab(chrome::GetActiveWebContents(browser())); |
119 SimpleTest(GetTestURL(FilePath(FILE_PATH_LITERAL("transaction_test.html")))); | 121 SimpleTest(GetTestURL(FilePath(FILE_PATH_LITERAL("transaction_test.html")))); |
120 } | 122 } |
121 | 123 |
122 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, Bug84933Test) { | 124 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, Bug84933Test) { |
123 const GURL url = GetTestURL(FilePath(FILE_PATH_LITERAL("bug_84933.html"))); | 125 const GURL url = GetTestURL(FilePath(FILE_PATH_LITERAL("bug_84933.html"))); |
124 | 126 |
125 // Just navigate to the URL. Test will crash if it fails. | 127 // Just navigate to the URL. Test will crash if it fails. |
126 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 1); | 128 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 1); |
127 } | 129 } |
128 | 130 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 virtual void SetUpCommandLine(CommandLine* command_line) { | 181 virtual void SetUpCommandLine(CommandLine* command_line) { |
180 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); | 182 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); |
181 } | 183 } |
182 }; | 184 }; |
183 | 185 |
184 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithGCExposed, | 186 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithGCExposed, |
185 DatabaseCallbacksTest) { | 187 DatabaseCallbacksTest) { |
186 SimpleTest( | 188 SimpleTest( |
187 GetTestURL(FilePath(FILE_PATH_LITERAL("database_callbacks_first.html")))); | 189 GetTestURL(FilePath(FILE_PATH_LITERAL("database_callbacks_first.html")))); |
188 } | 190 } |
OLD | NEW |