| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 void SimpleTest(const GURL& test_url, bool incognito = false) { | 34 void SimpleTest(const GURL& test_url, bool incognito = false) { |
| 35 // The test page will perform tests on FileAPI, then navigate to either | 35 // The test page will perform tests on FileAPI, then navigate to either |
| 36 // a #pass or #fail ref. | 36 // a #pass or #fail ref. |
| 37 Browser* the_browser = incognito ? CreateIncognitoBrowser() : browser(); | 37 Browser* the_browser = incognito ? CreateIncognitoBrowser() : browser(); |
| 38 | 38 |
| 39 LOG(INFO) << "Navigating to URL and blocking."; | 39 LOG(INFO) << "Navigating to URL and blocking."; |
| 40 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( | 40 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
| 41 the_browser, test_url, 2); | 41 the_browser, test_url, 2); |
| 42 LOG(INFO) << "Navigation done."; | 42 LOG(INFO) << "Navigation done."; |
| 43 std::string result = the_browser->GetSelectedTabContents()->GetURL().ref(); | 43 std::string result = the_browser->GetSelectedWebContents()->GetURL().ref(); |
| 44 if (result != "pass") { | 44 if (result != "pass") { |
| 45 std::string js_result; | 45 std::string js_result; |
| 46 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( | 46 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( |
| 47 the_browser->GetSelectedTabContents()->GetRenderViewHost(), L"", | 47 the_browser->GetSelectedWebContents()->GetRenderViewHost(), L"", |
| 48 L"window.domAutomationController.send(getLog())", &js_result)); | 48 L"window.domAutomationController.send(getLog())", &js_result)); |
| 49 FAIL() << "Failed: " << js_result; | 49 FAIL() << "Failed: " << js_result; |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 class FileSystemBrowserTestWithLowQuota : public FileSystemBrowserTest { | 54 class FileSystemBrowserTestWithLowQuota : public FileSystemBrowserTest { |
| 55 public: | 55 public: |
| 56 virtual void SetUpOnMainThread() { | 56 virtual void SetUpOnMainThread() { |
| 57 const int kInitialQuotaKilobytes = 5000; | 57 const int kInitialQuotaKilobytes = 5000; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 83 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("request_test.html")))); | 83 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("request_test.html")))); |
| 84 } | 84 } |
| 85 | 85 |
| 86 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, CreateTest) { | 86 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, CreateTest) { |
| 87 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("create_test.html")))); | 87 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("create_test.html")))); |
| 88 } | 88 } |
| 89 | 89 |
| 90 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTestWithLowQuota, QuotaTest) { | 90 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTestWithLowQuota, QuotaTest) { |
| 91 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("quota_test.html")))); | 91 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("quota_test.html")))); |
| 92 } | 92 } |
| OLD | NEW |