diff options
-rw-r--r-- | chrome/browser_tests.isolate | 32 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 6 | ||||
-rw-r--r-- | chrome/test/data/webkit/async_script_abort_on_end.html | 8 | ||||
-rw-r--r-- | chrome/test/data/webkit/resources/xslt-bad-import-uri.xml | 4 | ||||
-rw-r--r-- | chrome/test/data/webkit/resources/xslt-bad-import-uri.xsl | 10 | ||||
-rw-r--r-- | chrome/test/data/webkit/xslt-bad-import.html | 14 | ||||
-rw-r--r-- | content/browser/in_process_webkit/indexed_db_browsertest.cc | 87 | ||||
-rw-r--r-- | content/browser/indexed_db/idbbindingutilities_browsertest.cc | 35 | ||||
-rw-r--r-- | content/browser/plugin_data_remover_impl_browsertest.cc | 13 | ||||
-rw-r--r-- | content/browser/plugin_service_impl_browsertest.cc | 56 | ||||
-rw-r--r-- | content/browser/renderer_host/render_view_host_browsertest.cc | 39 | ||||
-rw-r--r-- | content/browser/webkit_browsertest.cc | 24 | ||||
-rw-r--r-- | content/content_tests.gypi | 8 | ||||
-rw-r--r-- | content/shell/shell_browser_main_parts.cc | 2 |
14 files changed, 132 insertions, 206 deletions
diff --git a/chrome/browser_tests.isolate b/chrome/browser_tests.isolate index fdf66bc..00930ed 100644 --- a/chrome/browser_tests.isolate +++ b/chrome/browser_tests.isolate @@ -102,37 +102,6 @@ '<(PRODUCT_DIR)/browser_tests<(EXECUTABLE_SUFFIX)', ], 'isolate_dependency_tracked': [ - '../content/test/data/indexeddb/bug_106883.html', - '../content/test/data/indexeddb/bug_106883.js', - '../content/test/data/indexeddb/bug_109187.html', - '../content/test/data/indexeddb/bug_109187.js', - '../content/test/data/indexeddb/bug_84933.html', - '../content/test/data/indexeddb/bug_84933.js', - '../content/test/data/indexeddb/common.js', - '../content/test/data/indexeddb/cursor_prefetch.html', - '../content/test/data/indexeddb/cursor_prefetch.js', - '../content/test/data/indexeddb/cursor_test.html', - '../content/test/data/indexeddb/cursor_test.js', - '../content/test/data/indexeddb/database_callbacks_first.html', - '../content/test/data/indexeddb/database_callbacks_second.html', - '../content/test/data/indexeddb/database_test.html', - '../content/test/data/indexeddb/database_test.js', - '../content/test/data/indexeddb/index_test.html', - '../content/test/data/indexeddb/index_test.js', - '../content/test/data/indexeddb/key_path_test.html', - '../content/test/data/indexeddb/key_path_test.js', - '../content/test/data/indexeddb/key_types_test.html', - '../content/test/data/indexeddb/key_types_test.js', - '../content/test/data/indexeddb/object_store_test.html', - '../content/test/data/indexeddb/object_store_test.js', - '../content/test/data/indexeddb/quota_test.html', - '../content/test/data/indexeddb/quota_test.js', - '../content/test/data/indexeddb/transaction_get_test.html', - '../content/test/data/indexeddb/transaction_get_test.js', - '../content/test/data/indexeddb/transaction_run_forever.html', - '../content/test/data/indexeddb/transaction_run_forever.js', - '../content/test/data/indexeddb/transaction_test.html', - '../content/test/data/indexeddb/transaction_test.js', '../net/data/ssl/certificates/expired_cert.pem', '../net/tools/testserver/asn1der.py', '../net/tools/testserver/device_management.py', @@ -566,7 +535,6 @@ 'test/data/geolocation/simple.html', 'test/data/geolocation/tab_destroyed.html', 'test/data/geolocation/tab_destroyed_frame.html', - 'test/data/google.mht', 'test/data/google/logo.gif', 'test/data/gpu/canvas_popup.html', 'test/data/gpu/feature_canvas2d.html', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 79d4030..b010cd3 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -3040,17 +3040,11 @@ '../content/browser/accessibility/dump_accessibility_tree_helper.h', '../content/browser/accessibility/dump_accessibility_tree_helper_mac.mm', '../content/browser/accessibility/dump_accessibility_tree_helper_win.cc', - '../content/browser/in_process_webkit/indexed_db_browsertest.cc', - '../content/browser/indexed_db/idbbindingutilities_browsertest.cc', - '../content/browser/plugin_data_remover_impl_browsertest.cc', - '../content/browser/plugin_service_impl_browsertest.cc', '../content/browser/renderer_host/render_process_host_browsertest.cc', - '../content/browser/renderer_host/render_view_host_browsertest.cc', '../content/browser/renderer_host/render_view_host_manager_browsertest.cc', '../content/browser/renderer_host/resource_dispatcher_host_browsertest.cc', '../content/browser/session_history_browsertest.cc', '../content/browser/speech/speech_recognition_browsertest.cc', - '../content/browser/webkit_browsertest.cc', ], 'rules': [ { diff --git a/chrome/test/data/webkit/async_script_abort_on_end.html b/chrome/test/data/webkit/async_script_abort_on_end.html deleted file mode 100644 index 9ae1787..0000000 --- a/chrome/test/data/webkit/async_script_abort_on_end.html +++ /dev/null @@ -1,8 +0,0 @@ -<html> -<head> -<script async src="http://url.handled.by.abort.on.end/400"></script> -</head> -<body> -If you have <a href="http://crbug.com/75604">bug 75604</a> then this page should crash on you. -</body> -</html> diff --git a/chrome/test/data/webkit/resources/xslt-bad-import-uri.xml b/chrome/test/data/webkit/resources/xslt-bad-import-uri.xml deleted file mode 100644 index 4751c19..0000000 --- a/chrome/test/data/webkit/resources/xslt-bad-import-uri.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version='1.0' encoding="UTF-8" ?> -<?xml-stylesheet type="text/xsl" href="xslt-bad-import-uri.xsl"?> -<catalog> -</catalog> diff --git a/chrome/test/data/webkit/resources/xslt-bad-import-uri.xsl b/chrome/test/data/webkit/resources/xslt-bad-import-uri.xsl deleted file mode 100644 index bc04da0..0000000 --- a/chrome/test/data/webkit/resources/xslt-bad-import-uri.xsl +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!--Copyright (c) 2011 The Chromium Authors. All rights reserved. - Use of this source code is governed by a BSD-style license that can be - found in the LICENSE file. --> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> -<xsl:import href="nosuchfileatall"/> -<xsl:template match="/"> - <xsl:apply-imports/> -</xsl:template> -</xsl:stylesheet> diff --git a/chrome/test/data/webkit/xslt-bad-import.html b/chrome/test/data/webkit/xslt-bad-import.html deleted file mode 100644 index d178c02..0000000 --- a/chrome/test/data/webkit/xslt-bad-import.html +++ /dev/null @@ -1,14 +0,0 @@ -<html> - <head> - <script> - window.onload = function() { - document.getElementById('d').innerHTML='' - } - </script> - </head> - <body> - <span id="d"> - <iframe src="resources/xslt-bad-import-uri.xml"></iframe> - </span> - </body> -</html> diff --git a/content/browser/in_process_webkit/indexed_db_browsertest.cc b/content/browser/in_process_webkit/indexed_db_browsertest.cc index a512e86..bc38a1c 100644 --- a/content/browser/in_process_webkit/indexed_db_browsertest.cc +++ b/content/browser/in_process_webkit/indexed_db_browsertest.cc @@ -11,55 +11,46 @@ #include "base/scoped_temp_dir.h" #include "base/test/thread_test_helper.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_tabstrip.h" -#include "chrome/test/base/in_process_browser_test.h" -#include "chrome/test/base/testing_profile.h" -#include "chrome/test/base/ui_test_utils.h" #include "content/browser/in_process_webkit/indexed_db_context_impl.h" #include "content/browser/web_contents/web_contents_impl.h" +#include "content/public/browser/browser_context.h" +#include "content/public/browser/browser_thread.h" #include "content/public/common/content_paths.h" #include "content/public/common/content_switches.h" #include "content/public/test/browser_test_utils.h" +#include "content/shell/shell.h" +#include "content/test/content_browser_test.h" +#include "content/test/content_browser_test_utils.h" #include "net/base/net_util.h" #include "webkit/database/database_util.h" #include "webkit/quota/mock_special_storage_policy.h" #include "webkit/quota/quota_manager.h" #include "webkit/quota/special_storage_policy.h" -using content::BrowserContext; -using content::BrowserThread; using quota::QuotaManager; using webkit_database::DatabaseUtil; +namespace content { + // This browser test is aimed towards exercising the IndexedDB bindings and // the actual implementation that lives in the browser side (in_process_webkit). -class IndexedDBBrowserTest : public InProcessBrowserTest { +class IndexedDBBrowserTest : public ContentBrowserTest { public: IndexedDBBrowserTest() {} - GURL GetTestURL(const FilePath& file_path) { - FilePath dir; - PathService::Get(content::DIR_TEST_DATA, &dir); - return net::FilePathToFileURL( - dir.Append(FILE_PATH_LITERAL("indexeddb")).Append(file_path)); - } - void SimpleTest(const GURL& test_url, bool incognito = false) { // The test page will perform tests on IndexedDB, then navigate to either // a #pass or #fail ref. - Browser* the_browser = incognito ? CreateIncognitoBrowser() : browser(); + Shell* the_browser = incognito ? CreateOffTheRecordBrowser() : shell(); LOG(INFO) << "Navigating to URL and blocking."; - ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( - the_browser, test_url, 2); + NavigateToURLBlockUntilNavigationsComplete(the_browser, test_url, 2); LOG(INFO) << "Navigation done."; - std::string result = - chrome::GetActiveWebContents(the_browser)->GetURL().ref(); + std::string result = the_browser->web_contents()->GetURL().ref(); if (result != "pass") { std::string js_result; - ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString( - chrome::GetActiveWebContents(the_browser)->GetRenderViewHost(), L"", + ASSERT_TRUE(ExecuteJavaScriptAndExtractString( + the_browser->web_contents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(getLog())", &js_result)); FAIL() << "Failed: " << js_result; } @@ -67,78 +58,76 @@ class IndexedDBBrowserTest : public InProcessBrowserTest { }; IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CursorTest) { - SimpleTest(GetTestURL(FilePath(FILE_PATH_LITERAL("cursor_test.html")))); + SimpleTest(GetTestUrl("indexeddb", "cursor_test.html")); } IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CursorTestIncognito) { - SimpleTest(GetTestURL(FilePath(FILE_PATH_LITERAL("cursor_test.html"))), + SimpleTest(GetTestUrl("indexeddb", "cursor_test.html"), true /* incognito */); } IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, CursorPrefetch) { - SimpleTest(GetTestURL(FilePath(FILE_PATH_LITERAL("cursor_prefetch.html")))); + SimpleTest(GetTestUrl("indexeddb", "cursor_prefetch.html")); } IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, IndexTest) { - SimpleTest(GetTestURL(FilePath(FILE_PATH_LITERAL("index_test.html")))); + SimpleTest(GetTestUrl("indexeddb", "index_test.html")); } IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, KeyPathTest) { - SimpleTest(GetTestURL(FilePath(FILE_PATH_LITERAL("key_path_test.html")))); + SimpleTest(GetTestUrl("indexeddb", "key_path_test.html")); } IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, TransactionGetTest) { - SimpleTest(GetTestURL(FilePath( - FILE_PATH_LITERAL("transaction_get_test.html")))); + SimpleTest(GetTestUrl("indexeddb", "transaction_get_test.html")); } IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, KeyTypesTest) { - SimpleTest(GetTestURL(FilePath(FILE_PATH_LITERAL("key_types_test.html")))); + SimpleTest(GetTestUrl("indexeddb", "key_types_test.html")); } IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, ObjectStoreTest) { - SimpleTest(GetTestURL(FilePath(FILE_PATH_LITERAL("object_store_test.html")))); + SimpleTest(GetTestUrl("indexeddb", "object_store_test.html")); } IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DatabaseTest) { - SimpleTest(GetTestURL(FilePath(FILE_PATH_LITERAL("database_test.html")))); + SimpleTest(GetTestUrl("indexeddb", "database_test.html")); } IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, TransactionTest) { - SimpleTest(GetTestURL(FilePath(FILE_PATH_LITERAL("transaction_test.html")))); + SimpleTest(GetTestUrl("indexeddb", "transaction_test.html")); } // Appears flaky/slow, see: http://crbug.com/120298 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DISABLED_ValueSizeTest) { - SimpleTest(GetTestURL(FilePath(FILE_PATH_LITERAL("value_size_test.html")))); + SimpleTest(GetTestUrl("indexeddb", "value_size_test.html")); } IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DoesntHangTest) { - SimpleTest(GetTestURL(FilePath( - FILE_PATH_LITERAL("transaction_run_forever.html")))); - content::CrashTab(chrome::GetActiveWebContents(browser())); - SimpleTest(GetTestURL(FilePath(FILE_PATH_LITERAL("transaction_test.html")))); + SimpleTest(GetTestUrl("indexeddb", "transaction_run_forever.html")); + CrashTab(shell()->web_contents()); + SimpleTest(GetTestUrl("indexeddb", "transaction_test.html")); } IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, Bug84933Test) { - const GURL url = GetTestURL(FilePath(FILE_PATH_LITERAL("bug_84933.html"))); + const GURL url = GetTestUrl("indexeddb", "bug_84933.html"); // Just navigate to the URL. Test will crash if it fails. - ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 1); + NavigateToURLBlockUntilNavigationsComplete(shell(), url, 1); } IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, Bug106883Test) { - const GURL url = GetTestURL(FilePath(FILE_PATH_LITERAL("bug_106883.html"))); + const GURL url = GetTestUrl("indexeddb", "bug_106883.html"); // Just navigate to the URL. Test will crash if it fails. - ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 1); + NavigateToURLBlockUntilNavigationsComplete(shell(), url, 1); } IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, Bug109187Test) { - const GURL url = GetTestURL(FilePath(FILE_PATH_LITERAL("bug_109187.html"))); + const GURL url = GetTestUrl("indexeddb", "bug_109187.html"); // Just navigate to the URL. Test will crash if it fails. - ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 1); + NavigateToURLBlockUntilNavigationsComplete(shell(), url, 1); } class IndexedDBBrowserTestWithLowQuota : public IndexedDBBrowserTest { @@ -149,7 +138,8 @@ class IndexedDBBrowserTestWithLowQuota : public IndexedDBBrowserTest { * 1024 * QuotaManager::kPerHostTemporaryPortion; SetTempQuota( kTemporaryStorageQuotaMaxSize, - content::BrowserContext::GetQuotaManager(browser()->profile())); + BrowserContext::GetQuotaManager( + shell()->web_contents()->GetBrowserContext())); } static void SetTempQuota(int64 bytes, scoped_refptr<QuotaManager> qm) { @@ -172,7 +162,7 @@ class IndexedDBBrowserTestWithLowQuota : public IndexedDBBrowserTest { }; IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithLowQuota, QuotaTest) { - SimpleTest(GetTestURL(FilePath(FILE_PATH_LITERAL("quota_test.html")))); + SimpleTest(GetTestUrl("indexeddb", "quota_test.html")); } class IndexedDBBrowserTestWithGCExposed : public IndexedDBBrowserTest { @@ -184,6 +174,7 @@ class IndexedDBBrowserTestWithGCExposed : public IndexedDBBrowserTest { IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithGCExposed, DatabaseCallbacksTest) { - SimpleTest( - GetTestURL(FilePath(FILE_PATH_LITERAL("database_callbacks_first.html")))); + SimpleTest(GetTestUrl("indexeddb", "database_callbacks_first.html")); } + +} // namespace content diff --git a/content/browser/indexed_db/idbbindingutilities_browsertest.cc b/content/browser/indexed_db/idbbindingutilities_browsertest.cc index e959ae3..d23dd99 100644 --- a/content/browser/indexed_db/idbbindingutilities_browsertest.cc +++ b/content/browser/indexed_db/idbbindingutilities_browsertest.cc @@ -3,9 +3,8 @@ // found in the LICENSE file. #include "base/bind.h" +#include "base/message_loop.h" #include "base/utf_string_conversions.h" -#include "chrome/test/base/in_process_browser_test.h" -#include "chrome/test/base/ui_test_utils.h" #include "content/browser/utility_process_host_impl.h" #include "content/public/browser/utility_process_host_client.h" #include "content/common/indexed_db/indexed_db_key.h" @@ -13,6 +12,8 @@ #include "content/common/utility_messages.h" #include "content/common/webkitplatformsupport_impl.h" #include "content/public/common/serialized_script_value.h" +#include "content/public/test/test_utils.h" +#include "content/test/content_browser_test.h" #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" @@ -20,15 +21,11 @@ #include "webkit/glue/idb_bindings.h" #include "webkit/glue/web_io_operators.h" -using content::BrowserThread; -using content::IndexedDBKey; -using content::IndexedDBKeyPath; -using content::UtilityProcessHost; -using content::UtilityProcessHostClient; -using content::SerializedScriptValue; using WebKit::WebSerializedScriptValue; using WebKit::WebIDBKeyPath; +namespace content { + // Enables calling WebKit::shutdown no matter where a "return" happens. class ScopedShutdownWebKit { public: @@ -45,7 +42,7 @@ class ScopedShutdownWebKit { // Sanity test, check the function call directly outside the sandbox. TEST(IDBKeyPathWithoutSandbox, Value) { - content::WebKitPlatformSupportImpl webkit_platform_support; + WebKitPlatformSupportImpl webkit_platform_support; WebKit::initialize(&webkit_platform_support); ScopedShutdownWebKit shutdown_webkit; @@ -242,19 +239,19 @@ class IDBKeyPathHelper : public UtilityProcessHostClient { // This test fixture runs in the UI thread. However, most of the work done by // UtilityProcessHost (and wrapped by IDBKeyPathHelper above) happens on the IO // thread. This fixture delegates to IDBKeyPathHelper and blocks via -// "content::RunMessageLoop()", until IDBKeyPathHelper posts a quit +// "RunMessageLoop()", until IDBKeyPathHelper posts a quit // message the MessageLoop. class ScopedIDBKeyPathHelper { public: ScopedIDBKeyPathHelper() { key_path_helper_ = new IDBKeyPathHelper(); key_path_helper_->CreateUtilityProcess(); - content::RunMessageLoop(); + RunMessageLoop(); } ~ScopedIDBKeyPathHelper() { key_path_helper_->DestroyUtilityProcess(); - content::RunMessageLoop(); + RunMessageLoop(); } void SetExpectedKeys(int id, @@ -274,14 +271,14 @@ class ScopedIDBKeyPathHelper { const IndexedDBKeyPath& key_path) { key_path_helper_->CheckValuesForKeyPath(id, serialized_script_values, key_path); - content::RunMessageLoop(); + RunMessageLoop(); } void CheckInjectValue(const IndexedDBKey& key, const SerializedScriptValue& value, const IndexedDBKeyPath& key_path) { key_path_helper_->CheckInjectValue(key, value, key_path); - content::RunMessageLoop(); + RunMessageLoop(); } private: @@ -289,7 +286,7 @@ class ScopedIDBKeyPathHelper { }; // Cases: -IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, IDBKeyPathExtract) { +IN_PROC_BROWSER_TEST_F(ContentBrowserTest, IDBKeyPathExtract) { ScopedIDBKeyPathHelper scoped_helper; const int kId = 7; std::vector<IndexedDBKey> expected_keys; @@ -333,7 +330,7 @@ IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, IDBKeyPathExtract) { kId, serialized_values, key_path); } -IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, IDBKeyPathPropertyNotAvailable) { +IN_PROC_BROWSER_TEST_F(ContentBrowserTest, IDBKeyPathPropertyNotAvailable) { ScopedIDBKeyPathHelper scoped_helper; const int kId = 7; std::vector<IndexedDBKey> expected_keys; @@ -360,7 +357,7 @@ IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, IDBKeyPathPropertyNotAvailable) { scoped_helper.CheckValuesForKeyPath(kId, serialized_values, key_path); } -IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, IDBKeyPathMultipleCalls) { +IN_PROC_BROWSER_TEST_F(ContentBrowserTest, IDBKeyPathMultipleCalls) { ScopedIDBKeyPathHelper scoped_helper; const int kId = 7; std::vector<IndexedDBKey> expected_keys; @@ -398,7 +395,7 @@ IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, IDBKeyPathMultipleCalls) { scoped_helper.CheckValuesForKeyPath(kId + 1, serialized_values, key_path); } -IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, InjectIDBKey) { +IN_PROC_BROWSER_TEST_F(ContentBrowserTest, InjectIDBKey) { // {foo: 'zoo'} const char16 initial_data[] = {0x0353,0x6f66,0x536f,0x7a03,0x6f6f,0x017b}; SerializedScriptValue value( @@ -439,3 +436,5 @@ IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, InjectIDBKey) { key_path.SetString(UTF8ToUTF16("bar.baz")); scoped_helper.CheckInjectValue(key, value, key_path); } + +} // namespace content diff --git a/content/browser/plugin_data_remover_impl_browsertest.cc b/content/browser/plugin_data_remover_impl_browsertest.cc index a087cf4..4ca35c5 100644 --- a/content/browser/plugin_data_remover_impl_browsertest.cc +++ b/content/browser/plugin_data_remover_impl_browsertest.cc @@ -7,9 +7,11 @@ #include "base/path_service.h" #include "base/synchronization/waitable_event_watcher.h" #include "content/browser/plugin_data_remover_impl.h" +#include "content/public/browser/web_contents.h" #include "content/public/common/content_switches.h" -#include "chrome/test/base/in_process_browser_test.h" -#include "chrome/test/base/ui_test_utils.h" +#include "content/public/test/test_utils.h" +#include "content/shell/shell.h" +#include "content/test/content_browser_test.h" namespace content { @@ -17,10 +19,10 @@ namespace { const char* kNPAPITestPluginMimeType = "application/vnd.npapi-test"; } -class PluginDataRemoverTest : public InProcessBrowserTest, +class PluginDataRemoverTest : public ContentBrowserTest, public base::WaitableEventWatcher::Delegate { public: - PluginDataRemoverTest() : InProcessBrowserTest() { } + PluginDataRemoverTest() {} virtual void OnWaitableEventSignaled(base::WaitableEvent* waitable_event) { MessageLoop::current()->Quit(); @@ -43,7 +45,8 @@ class PluginDataRemoverTest : public InProcessBrowserTest, }; IN_PROC_BROWSER_TEST_F(PluginDataRemoverTest, RemoveData) { - PluginDataRemoverImpl plugin_data_remover(GetBrowserContext()); + PluginDataRemoverImpl plugin_data_remover( + shell()->web_contents()->GetBrowserContext()); plugin_data_remover.set_mime_type(kNPAPITestPluginMimeType); base::WaitableEventWatcher watcher; base::WaitableEvent* event = diff --git a/content/browser/plugin_service_impl_browsertest.cc b/content/browser/plugin_service_impl_browsertest.cc index 74afbb9..78ede71 100644 --- a/content/browser/plugin_service_impl_browsertest.cc +++ b/content/browser/plugin_service_impl_browsertest.cc @@ -8,19 +8,18 @@ #include "base/bind_helpers.h" #include "base/command_line.h" #include "base/path_service.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/test/base/in_process_browser_test.h" -#include "chrome/test/base/testing_profile.h" -#include "chrome/test/base/ui_test_utils.h" +#include "content/public/browser/browser_context.h" #include "content/public/browser/resource_context.h" +#include "content/public/browser/web_contents.h" #include "content/public/common/content_switches.h" #include "content/public/test/test_browser_thread.h" +#include "content/public/test/test_utils.h" +#include "content/shell/shell.h" +#include "content/test/content_browser_test.h" #include "testing/gmock/include/gmock/gmock.h" #include "webkit/plugins/npapi/plugin_list.h" -using content::BrowserThread; - -namespace { +namespace content { const char kNPAPITestPluginMimeType[] = "application/vnd.npapi-test"; @@ -36,7 +35,7 @@ void OpenChannel(PluginProcessHost::Client* client) { class MockPluginProcessHostClient : public PluginProcessHost::Client, public IPC::Listener { public: - MockPluginProcessHostClient(content::ResourceContext* context) + MockPluginProcessHostClient(ResourceContext* context) : context_(context), channel_(NULL), set_plugin_info_called_(false) { @@ -50,7 +49,7 @@ class MockPluginProcessHostClient : public PluginProcessHost::Client, // PluginProcessHost::Client implementation. virtual int ID() OVERRIDE { return 42; } virtual bool OffTheRecord() OVERRIDE { return false; } - virtual content::ResourceContext* GetResourceContext() OVERRIDE { + virtual ResourceContext* GetResourceContext() OVERRIDE { return context_; } virtual void OnFoundPluginProcessHost(PluginProcessHost* host) OVERRIDE {} @@ -105,15 +104,19 @@ class MockPluginProcessHostClient : public PluginProcessHost::Client, MessageLoop::QuitClosure()); } - content::ResourceContext* context_; + ResourceContext* context_; IPC::Channel* channel_; bool set_plugin_info_called_; DISALLOW_COPY_AND_ASSIGN(MockPluginProcessHostClient); }; -class PluginServiceTest : public InProcessBrowserTest { +class PluginServiceTest : public ContentBrowserTest { public: - PluginServiceTest() : InProcessBrowserTest() { } + PluginServiceTest() {} + + ResourceContext* GetResourceContext() { + return shell()->web_contents()->GetBrowserContext()->GetResourceContext(); + } virtual void SetUpCommandLine(CommandLine* command_line) { #ifdef OS_MACOSX @@ -134,19 +137,18 @@ class PluginServiceTest : public InProcessBrowserTest { // Try to open a channel to the test plugin. Minimal plugin process spawning // test for the PluginService interface. IN_PROC_BROWSER_TEST_F(PluginServiceTest, OpenChannelToPlugin) { - MockPluginProcessHostClient mock_client( - browser()->profile()->GetResourceContext()); + MockPluginProcessHostClient mock_client(GetResourceContext()); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&OpenChannel, &mock_client)); - content::RunMessageLoop(); + RunMessageLoop(); } // A strict mock that fails if any of the methods are called. They shouldn't be // called since the request should get canceled before then. class MockCanceledPluginServiceClient : public PluginProcessHost::Client { public: - MockCanceledPluginServiceClient(content::ResourceContext* context) + MockCanceledPluginServiceClient(ResourceContext* context) : context_(context), get_resource_context_called_(false) { } @@ -155,7 +157,7 @@ class MockCanceledPluginServiceClient : public PluginProcessHost::Client { // Client implementation. MOCK_METHOD0(ID, int()); - virtual content::ResourceContext* GetResourceContext() OVERRIDE { + virtual ResourceContext* GetResourceContext() OVERRIDE { get_resource_context_called_ = true; return context_; } @@ -171,7 +173,7 @@ class MockCanceledPluginServiceClient : public PluginProcessHost::Client { } private: - content::ResourceContext* context_; + ResourceContext* context_; bool get_resource_context_called_; DISALLOW_COPY_AND_ASSIGN(MockCanceledPluginServiceClient); @@ -199,10 +201,10 @@ void OpenChannelAndThenCancel(PluginProcessHost::Client* client) { // Should not attempt to open a channel, since it should be canceled early on. IN_PROC_BROWSER_TEST_F(PluginServiceTest, CancelOpenChannelToPluginService) { ::testing::StrictMock<MockCanceledPluginServiceClient> mock_client( - browser()->profile()->GetResourceContext()); + GetResourceContext()); BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind(OpenChannelAndThenCancel, &mock_client)); - content::RunMessageLoop(); + RunMessageLoop(); EXPECT_TRUE(mock_client.get_resource_context_called()); } @@ -210,7 +212,7 @@ class MockCanceledBeforeSentPluginProcessHostClient : public MockCanceledPluginServiceClient { public: MockCanceledBeforeSentPluginProcessHostClient( - content::ResourceContext* context) + ResourceContext* context) : MockCanceledPluginServiceClient(context), set_plugin_info_called_(false), on_found_plugin_process_host_called_(false), @@ -269,11 +271,11 @@ class MockCanceledBeforeSentPluginProcessHostClient IN_PROC_BROWSER_TEST_F( PluginServiceTest, CancelBeforeSentOpenChannelToPluginProcessHost) { ::testing::StrictMock<MockCanceledBeforeSentPluginProcessHostClient> - mock_client(browser()->profile()->GetResourceContext()); + mock_client(GetResourceContext()); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&OpenChannel, &mock_client)); - content::RunMessageLoop(); + RunMessageLoop(); EXPECT_TRUE(mock_client.get_resource_context_called()); EXPECT_TRUE(mock_client.set_plugin_info_called()); EXPECT_TRUE(mock_client.on_found_plugin_process_host_called()); @@ -283,7 +285,7 @@ class MockCanceledAfterSentPluginProcessHostClient : public MockCanceledBeforeSentPluginProcessHostClient { public: MockCanceledAfterSentPluginProcessHostClient( - content::ResourceContext* context) + ResourceContext* context) : MockCanceledBeforeSentPluginProcessHostClient(context), on_sent_plugin_channel_request_called_(false) {} virtual ~MockCanceledAfterSentPluginProcessHostClient() {} @@ -321,15 +323,15 @@ class MockCanceledAfterSentPluginProcessHostClient IN_PROC_BROWSER_TEST_F( PluginServiceTest, CancelAfterSentOpenChannelToPluginProcessHost) { ::testing::StrictMock<MockCanceledAfterSentPluginProcessHostClient> - mock_client(browser()->profile()->GetResourceContext()); + mock_client(GetResourceContext()); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&OpenChannel, &mock_client)); - content::RunMessageLoop(); + RunMessageLoop(); EXPECT_TRUE(mock_client.get_resource_context_called()); EXPECT_TRUE(mock_client.set_plugin_info_called()); EXPECT_TRUE(mock_client.on_found_plugin_process_host_called()); EXPECT_TRUE(mock_client.on_sent_plugin_channel_request_called()); } -} // namespace +} // namespace content diff --git a/content/browser/renderer_host/render_view_host_browsertest.cc b/content/browser/renderer_host/render_view_host_browsertest.cc index 2b54a10..12ac966 100644 --- a/content/browser/renderer_host/render_view_host_browsertest.cc +++ b/content/browser/renderer_host/render_view_host_browsertest.cc @@ -5,36 +5,35 @@ #include "base/time.h" #include "base/utf_string_conversions.h" #include "base/values.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_tabstrip.h" -#include "chrome/test/base/in_process_browser_test.h" -#include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/common/view_messages.h" #include "content/public/browser/notification_types.h" #include "content/public/browser/web_contents_observer.h" +#include "content/public/test/browser_test_utils.h" +#include "content/public/test/test_browser_thread.h" +#include "content/shell/shell.h" +#include "content/test/content_browser_test.h" +#include "content/test/content_browser_test_utils.h" #include "net/base/host_port_pair.h" #include "net/base/net_util.h" #include "net/test/test_server.h" -using content::RenderViewHostImpl; -using content::WebContents; +namespace content { -class RenderViewHostTest : public InProcessBrowserTest { +class RenderViewHostTest : public ContentBrowserTest { public: RenderViewHostTest() {} }; - IN_PROC_BROWSER_TEST_F(RenderViewHostTest, ExecuteJavascriptAndGetValue) { ASSERT_TRUE(test_server()->Start()); - GURL empty_url(test_server()->GetURL("files/empty.html")); - ui_test_utils::NavigateToURL(browser(), empty_url); + GURL empty_url(test_server()->GetURL("files/simple_page.html")); + NavigateToURL(shell(), empty_url); RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( - chrome::GetActiveWebContents(browser())->GetRenderViewHost()); + shell()->web_contents()->GetRenderViewHost()); { scoped_ptr<Value> value( @@ -206,11 +205,10 @@ class RenderViewHostTestWebContentsObserver IN_PROC_BROWSER_TEST_F(RenderViewHostTest, FrameNavigateSocketAddress) { ASSERT_TRUE(test_server()->Start()); - RenderViewHostTestWebContentsObserver observer( - chrome::GetActiveWebContents(browser())); + RenderViewHostTestWebContentsObserver observer(shell()->web_contents()); - GURL test_url = test_server()->GetURL("files/simple.html"); - ui_test_utils::NavigateToURL(browser(), test_url); + GURL test_url = test_server()->GetURL("files/simple_page.html"); + NavigateToURL(shell(), test_url); EXPECT_EQ(test_server()->host_port_pair().ToString(), observer.observed_socket_address().ToString()); @@ -219,18 +217,19 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostTest, FrameNavigateSocketAddress) { IN_PROC_BROWSER_TEST_F(RenderViewHostTest, BaseURLParam) { ASSERT_TRUE(test_server()->Start()); - RenderViewHostTestWebContentsObserver observer( - chrome::GetActiveWebContents(browser())); + RenderViewHostTestWebContentsObserver observer(shell()->web_contents()); // Base URL is not set if it is the same as the URL. - GURL test_url = test_server()->GetURL("files/simple.html"); - ui_test_utils::NavigateToURL(browser(), test_url); + GURL test_url = test_server()->GetURL("files/simple_page.tml"); + NavigateToURL(shell(), test_url); EXPECT_TRUE(observer.base_url().is_empty()); EXPECT_EQ(1, observer.navigation_count()); // But should be set to the original page when reading MHTML. test_url = net::FilePathToFileURL(test_server()->document_root().Append( FILE_PATH_LITERAL("google.mht"))); - ui_test_utils::NavigateToURL(browser(), test_url); + NavigateToURL(shell(), test_url); EXPECT_EQ("http://www.google.com/", observer.base_url().spec()); } + +} // namespace content diff --git a/content/browser/webkit_browsertest.cc b/content/browser/webkit_browsertest.cc index 677a5d0..78c2f87 100644 --- a/content/browser/webkit_browsertest.cc +++ b/content/browser/webkit_browsertest.cc @@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_tabstrip.h" -#include "chrome/test/base/in_process_browser_test.h" -#include "chrome/test/base/ui_test_utils.h" #include "content/browser/web_contents/web_contents_impl.h" +#include "content/public/browser/web_contents.h" +#include "content/shell/shell.h" +#include "content/test/content_browser_test.h" +#include "content/test/content_browser_test_utils.h" #include "content/test/net/url_request_abort_on_end_job.h" -typedef InProcessBrowserTest WebKitBrowserTest; +namespace content { -using content::WebContents; +typedef ContentBrowserTest WebKitBrowserTest; const char kAsyncScriptThatAbortsOnEndPage[] = "files/webkit/async_script_abort_on_end.html"; @@ -27,14 +27,13 @@ IN_PROC_BROWSER_TEST_F(WebKitBrowserTest, AbortOnEnd) { URLRequestAbortOnEndJob::AddUrlHandler(); GURL url = test_server()->GetURL(kAsyncScriptThatAbortsOnEndPage); - ui_test_utils::NavigateToURL(browser(), url); + NavigateToURL(shell(), url); - WebContents* web_contents = chrome::GetActiveWebContents(browser()); // If you are seeing this test fail, please strongly investigate the // possibility that http://crbug.com/75604 and // https://bugs.webkit.org/show_bug.cgi?id=71122 have reverted before // marking this as flakey. - EXPECT_FALSE(web_contents->IsCrashed()); + EXPECT_FALSE(shell()->web_contents()->IsCrashed()); } // This is a browser test because the DumpRenderTree framework holds @@ -51,8 +50,9 @@ IN_PROC_BROWSER_TEST_F(WebKitBrowserTest, XsltBadImport) { URLRequestAbortOnEndJob::AddUrlHandler(); GURL url = test_server()->GetURL(kXsltBadImportPage); - ui_test_utils::NavigateToURL(browser(), url); + NavigateToURL(shell(), url); - WebContents* web_contents = chrome::GetActiveWebContents(browser()); - EXPECT_FALSE(web_contents->IsCrashed()); + EXPECT_FALSE(shell()->web_contents()->IsCrashed()); } + +} // namespace content diff --git a/content/content_tests.gypi b/content/content_tests.gypi index 12f5cde..aab94ce 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -433,7 +433,7 @@ 'browser/renderer_host/p2p/socket_host_udp_unittest.cc', 'renderer/media/media_stream_dispatcher_unittest.cc', 'renderer/media/media_stream_impl_unittest.cc', - 'renderer/media/peer_connection_handler_jsep_unittest.cc', + 'renderer/media/peer_connection_handler_jsep_unittest.cc', 'renderer/media/rtc_video_decoder_unittest.cc', 'renderer/media/webrtc_audio_device_unittest.cc', 'renderer/p2p/p2p_transport_impl_unittest.cc', @@ -556,9 +556,15 @@ 'browser/dom_storage/dom_storage_browsertest.cc', 'browser/download/mhtml_generation_browsertest.cc', 'browser/fileapi/file_system_browsertest.cc', + 'browser/in_process_webkit/indexed_db_browsertest.cc', 'browser/in_process_webkit/indexed_db_layout_browsertest.cc', + 'browser/indexed_db/idbbindingutilities_browsertest.cc', 'browser/media_browsertest.cc', + 'browser/plugin_data_remover_impl_browsertest.cc', 'browser/plugin_browsertest.cc', + 'browser/plugin_service_impl_browsertest.cc', + 'browser/renderer_host/render_view_host_browsertest.cc', + 'browser/webkit_browsertest.cc', 'browser/worker_host/test/worker_browsertest.cc', 'renderer/mouse_lock_dispatcher_browsertest.cc', 'renderer/pepper/pepper_file_chooser_host_unittest.cc', diff --git a/content/shell/shell_browser_main_parts.cc b/content/shell/shell_browser_main_parts.cc index a55b6ba..999183c 100644 --- a/content/shell/shell_browser_main_parts.cc +++ b/content/shell/shell_browser_main_parts.cc @@ -30,7 +30,7 @@ namespace content { static GURL GetStartupURL() { CommandLine* command_line = CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(switches::kContentBrowserTest)) - return GURL(chrome::kAboutBlankURL); + return GURL(); const CommandLine::StringVector& args = command_line->GetArgs(); if (args.empty()) return GURL("http://www.google.com/"); |