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/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/test/thread_test_helper.h" | 9 #include "base/test/thread_test_helper.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/browser/ui/browser_tabstrip.h" |
11 #include "chrome/test/base/in_process_browser_test.h" | 12 #include "chrome/test/base/in_process_browser_test.h" |
12 #include "chrome/test/base/testing_profile.h" | 13 #include "chrome/test/base/testing_profile.h" |
13 #include "chrome/test/base/ui_test_utils.h" | 14 #include "chrome/test/base/ui_test_utils.h" |
14 #include "content/browser/web_contents/web_contents_impl.h" | 15 #include "content/browser/web_contents/web_contents_impl.h" |
15 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
16 #include "webkit/quota/quota_manager.h" | 17 #include "webkit/quota/quota_manager.h" |
17 | 18 |
18 using content::BrowserThread; | 19 using content::BrowserThread; |
19 using quota::QuotaManager; | 20 using quota::QuotaManager; |
20 | 21 |
(...skipping 12 matching lines...) Expand all Loading... |
33 | 34 |
34 void SimpleTest(const GURL& test_url, bool incognito = false) { | 35 void SimpleTest(const GURL& test_url, bool incognito = false) { |
35 // The test page will perform tests on FileAPI, then navigate to either | 36 // The test page will perform tests on FileAPI, then navigate to either |
36 // a #pass or #fail ref. | 37 // a #pass or #fail ref. |
37 Browser* the_browser = incognito ? CreateIncognitoBrowser() : browser(); | 38 Browser* the_browser = incognito ? CreateIncognitoBrowser() : browser(); |
38 | 39 |
39 LOG(INFO) << "Navigating to URL and blocking."; | 40 LOG(INFO) << "Navigating to URL and blocking."; |
40 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( | 41 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
41 the_browser, test_url, 2); | 42 the_browser, test_url, 2); |
42 LOG(INFO) << "Navigation done."; | 43 LOG(INFO) << "Navigation done."; |
43 std::string result = the_browser->GetActiveWebContents()->GetURL().ref(); | 44 std::string result = |
| 45 chrome::GetActiveWebContents(the_browser)->GetURL().ref(); |
44 if (result != "pass") { | 46 if (result != "pass") { |
45 std::string js_result; | 47 std::string js_result; |
46 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( | 48 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( |
47 the_browser->GetActiveWebContents()->GetRenderViewHost(), L"", | 49 chrome::GetActiveWebContents(the_browser)->GetRenderViewHost(), L"", |
48 L"window.domAutomationController.send(getLog())", &js_result)); | 50 L"window.domAutomationController.send(getLog())", &js_result)); |
49 FAIL() << "Failed: " << js_result; | 51 FAIL() << "Failed: " << js_result; |
50 } | 52 } |
51 } | 53 } |
52 }; | 54 }; |
53 | 55 |
54 class FileSystemBrowserTestWithLowQuota : public FileSystemBrowserTest { | 56 class FileSystemBrowserTestWithLowQuota : public FileSystemBrowserTest { |
55 public: | 57 public: |
56 virtual void SetUpOnMainThread() { | 58 virtual void SetUpOnMainThread() { |
57 const int kInitialQuotaKilobytes = 5000; | 59 const int kInitialQuotaKilobytes = 5000; |
(...skipping 26 matching lines...) Expand all Loading... |
84 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("request_test.html")))); | 86 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("request_test.html")))); |
85 } | 87 } |
86 | 88 |
87 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, CreateTest) { | 89 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, CreateTest) { |
88 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("create_test.html")))); | 90 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("create_test.html")))); |
89 } | 91 } |
90 | 92 |
91 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTestWithLowQuota, QuotaTest) { | 93 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTestWithLowQuota, QuotaTest) { |
92 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("quota_test.html")))); | 94 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("quota_test.html")))); |
93 } | 95 } |
OLD | NEW |