diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-04 14:45:50 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-04 14:45:50 +0000 |
commit | b1e3f20a987493e568ec36fdae0b1bebb816833e (patch) | |
tree | ddf406197a133615dd9663a23606ef0d6d1c163c /content | |
parent | efec4f974d787da702c1564518903f3847db42f0 (diff) | |
download | chromium_src-b1e3f20a987493e568ec36fdae0b1bebb816833e.zip chromium_src-b1e3f20a987493e568ec36fdae0b1bebb816833e.tar.gz chromium_src-b1e3f20a987493e568ec36fdae0b1bebb816833e.tar.bz2 |
Move the rest of the content\test headers that are used by embedders to content\public\test. This way we can enforce that internal content headers don't leak to embedders.
BUG=98716
TBR=phajdan.jr
Review URL: https://chromiumcodereview.appspot.com/10483003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140287 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
17 files changed, 67 insertions, 63 deletions
diff --git a/content/browser/geolocation/network_location_provider_unittest.cc b/content/browser/geolocation/network_location_provider_unittest.cc index f2adee3..3dfd473 100644 --- a/content/browser/geolocation/network_location_provider_unittest.cc +++ b/content/browser/geolocation/network_location_provider_unittest.cc @@ -11,7 +11,7 @@ #include "base/values.h" #include "content/browser/geolocation/fake_access_token_store.h" #include "content/browser/geolocation/network_location_provider.h" -#include "content/test/test_url_fetcher_factory.h" +#include "content/public/test/test_url_fetcher_factory.h" #include "net/url_request/url_request_status.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/content/browser/intents/intent_injector_unittest.cc b/content/browser/intents/intent_injector_unittest.cc index 07b21ba..ddcecc8 100644 --- a/content/browser/intents/intent_injector_unittest.cc +++ b/content/browser/intents/intent_injector_unittest.cc @@ -12,7 +12,7 @@ #include "content/common/intents_messages.h" #include "content/common/view_messages.h" #include "content/public/test/mock_render_process_host.h" -#include "content/test/web_contents_tester.h" +#include "content/public/test/web_contents_tester.h" #include "webkit/glue/web_intent_data.h" #include "webkit/glue/web_intent_reply_data.h" diff --git a/content/browser/renderer_host/test_render_view_host.h b/content/browser/renderer_host/test_render_view_host.h index bb8bcc2..aa12d36 100644 --- a/content/browser/renderer_host/test_render_view_host.h +++ b/content/browser/renderer_host/test_render_view_host.h @@ -12,7 +12,7 @@ #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" #include "content/public/common/page_transition_types.h" -#include "content/test/test_renderer_host.h" +#include "content/public/test/test_renderer_host.h" // This file provides a testing framework for mocking out the RenderProcessHost // layer. It allows you to test RenderViewHost, WebContentsImpl, diff --git a/content/browser/speech/google_one_shot_remote_engine_unittest.cc b/content/browser/speech/google_one_shot_remote_engine_unittest.cc index fe31487..a393302 100644 --- a/content/browser/speech/google_one_shot_remote_engine_unittest.cc +++ b/content/browser/speech/google_one_shot_remote_engine_unittest.cc @@ -8,7 +8,7 @@ #include "content/browser/speech/google_one_shot_remote_engine.h" #include "content/public/common/speech_recognition_error.h" #include "content/public/common/speech_recognition_result.h" -#include "content/test/test_url_fetcher_factory.h" +#include "content/public/test/test_url_fetcher_factory.h" #include "net/url_request/url_request_context_getter.h" #include "net/url_request/url_request_status.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/content/browser/speech/speech_recognizer_impl_unittest.cc b/content/browser/speech/speech_recognizer_impl_unittest.cc index 24786ca..542a562 100644 --- a/content/browser/speech/speech_recognizer_impl_unittest.cc +++ b/content/browser/speech/speech_recognizer_impl_unittest.cc @@ -8,7 +8,7 @@ #include "content/browser/speech/google_one_shot_remote_engine.h" #include "content/browser/speech/speech_recognizer_impl.h" #include "content/public/browser/speech_recognition_event_listener.h" -#include "content/test/test_url_fetcher_factory.h" +#include "content/public/test/test_url_fetcher_factory.h" #include "media/audio/audio_manager.h" #include "media/audio/fake_audio_input_stream.h" #include "media/audio/fake_audio_output_stream.h" diff --git a/content/browser/web_contents/test_web_contents.h b/content/browser/web_contents/test_web_contents.h index b3c5aa6..2db1829 100644 --- a/content/browser/web_contents/test_web_contents.h +++ b/content/browser/web_contents/test_web_contents.h @@ -8,7 +8,7 @@ #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/common/page_transition_types.h" -#include "content/test/web_contents_tester.h" +#include "content/public/test/web_contents_tester.h" #include "webkit/glue/webpreferences.h" class SiteInstanceImpl; diff --git a/content/browser/web_contents/web_drag_source_mac_unittest.mm b/content/browser/web_contents/web_drag_source_mac_unittest.mm index 100451e..a0f9b55 100644 --- a/content/browser/web_contents/web_drag_source_mac_unittest.mm +++ b/content/browser/web_contents/web_drag_source_mac_unittest.mm @@ -5,7 +5,7 @@ #import "content/browser/web_contents/web_drag_source_mac.h" #include "content/browser/web_contents/web_contents_impl.h" -#include "content/test/test_renderer_host.h" +#include "content/public/test/test_renderer_host.h" #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/glue/webdropdata.h" diff --git a/content/content_tests.gypi b/content/content_tests.gypi index 18bc770..c1d4154 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -43,6 +43,10 @@ 'public/test/test_file_error_injector.h', 'public/test/test_navigation_observer.h', 'public/test/test_notification_tracker.h', + 'public/test/test_renderer_host.h', + 'public/test/test_url_fetcher_factory.h', + 'public/test/unittest_test_suite.h', + 'public/test/web_contents_tester.h', # TODO(phajdan.jr): All of those files should live in content/test (if # they're only used by content) or content/public/test (if they're used # by other embedders). @@ -105,17 +109,13 @@ 'test/test_navigation_observer.cc', 'test/test_notification_tracker.cc', 'test/test_renderer_host.cc', - 'test/test_renderer_host.h', 'test/test_render_view_host_factory.cc', 'test/test_render_view_host_factory.h', 'test/test_url_fetcher_factory.cc', - 'test/test_url_fetcher_factory.h', 'test/test_web_contents_view.cc', 'test/test_web_contents_view.h', 'test/unittest_test_suite.cc', - 'test/unittest_test_suite.h', 'test/web_contents_tester.cc', - 'test/web_contents_tester.h', # TODO(phajdan.jr): Those files should be moved to webkit # test support target. diff --git a/content/test/test_renderer_host.h b/content/public/test/test_renderer_host.h index 4ecca64..3203544 100644 --- a/content/test/test_renderer_host.h +++ b/content/public/test/test_renderer_host.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_TEST_TEST_RENDERER_HOST_H_ -#define CONTENT_TEST_TEST_RENDERER_HOST_H_ +#ifndef CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ +#define CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ #pragma once #include "base/memory/scoped_ptr.h" @@ -184,4 +184,4 @@ class RenderViewHostTestHarness : public testing::Test { } // namespace content -#endif // CONTENT_TEST_TEST_RENDERER_HOST_H_ +#endif // CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ diff --git a/content/test/test_url_fetcher_factory.h b/content/public/test/test_url_fetcher_factory.h index e508a35..62c0735 100644 --- a/content/test/test_url_fetcher_factory.h +++ b/content/public/test/test_url_fetcher_factory.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_TEST_TEST_URL_FETCHER_FACTORY_H_ -#define CONTENT_TEST_TEST_URL_FETCHER_FACTORY_H_ +#ifndef CONTENT_PUBLIC_TEST_TEST_URL_FETCHER_FACTORY_H_ +#define CONTENT_PUBLIC_TEST_TEST_URL_FETCHER_FACTORY_H_ #pragma once #include <list> @@ -290,4 +290,4 @@ class URLFetcherImplFactory : public net::URLFetcherFactory { }; -#endif // CONTENT_TEST_TEST_URL_FETCHER_FACTORY_H_ +#endif // CONTENT_PUBLIC_TEST_TEST_URL_FETCHER_FACTORY_H_ diff --git a/content/test/unittest_test_suite.h b/content/public/test/unittest_test_suite.h index 64c4ea7..5e113fa 100644 --- a/content/test/unittest_test_suite.h +++ b/content/public/test/unittest_test_suite.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_TEST_UNITTEST_TEST_SUITE_H_ -#define CONTENT_TEST_UNITTEST_TEST_SUITE_H_ +#ifndef CONTENT_PUBLIC_TEST_UNITTEST_TEST_SUITE_H_ +#define CONTENT_PUBLIC_TEST_UNITTEST_TEST_SUITE_H_ #pragma once #include "base/basictypes.h" @@ -13,6 +13,8 @@ namespace base { class TestSuite; } +namespace content { + // A special test suite that also initializes WebKit once for all unittests. // This is useful for two reasons: // 1. It allows the use of some primitive WebKit data types like WebString. @@ -35,4 +37,6 @@ class UnitTestTestSuite { DISALLOW_COPY_AND_ASSIGN(UnitTestTestSuite); }; -#endif // CONTENT_TEST_UNITTEST_TEST_SUITE_H_ +} // namespace content + +#endif // CONTENT_PUBLIC_TEST_UNITTEST_TEST_SUITE_H_ diff --git a/content/test/web_contents_tester.h b/content/public/test/web_contents_tester.h index 5fdf288..1a3bcbe 100644 --- a/content/test/web_contents_tester.h +++ b/content/public/test/web_contents_tester.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_TEST_WEB_CONTENTS_TESTER_H_ -#define CONTENT_TEST_WEB_CONTENTS_TESTER_H_ +#ifndef CONTENT_PUBLIC_TEST_WEB_CONTENTS_TESTER_H_ +#define CONTENT_PUBLIC_TEST_WEB_CONTENTS_TESTER_H_ #pragma once #include "content/public/common/page_transition_types.h" @@ -22,41 +22,36 @@ class RenderViewHost; class SiteInstance; class WebContents; -// This interface allows embedders of content/ to write tests that -// depend on a test version of WebContents. This interface can be -// retrieved from any content::WebContents that was retrieved via a -// call to RenderViewHostTestHarness::GetWebContents() (directly or -// indirectly) or constructed explicitly via one of the -// WebContentsTester::Create... methods. +// This interface allows embedders of content/ to write tests that depend on a +// test version of WebContents. This interface can be retrieved from any +// WebContents that was retrieved via a call to +// RenderViewHostTestHarness::GetWebContents() (directly or indirectly) or +// constructed explicitly via one of the WebContentsTester::Create... methods. // -// Tests within content/ can directly static_cast WebContents objects -// retrieved or created as described above to -// content::TestWebContents. +// Tests within content/ can directly static_cast WebContents objects retrieved +// or created as described above to TestWebContents. // -// Design note: We considered two alternatives to this separate test -// interface approach: +// Design note: We considered two alternatives to this separate test interface +// approach: // -// a) Define a TestWebContents interface that inherits fromn -// WebContents, and have the concrete TestWebContents inherit from it -// as well as from content::WebContentsImpl. This approach was -// discarded as it introduces a diamond inheritance pattern, which -// means we wouldn't be e.g. able to downcast from WebContents to -// WebContentsImpl using static_cast. +// a) Define a TestWebContents interface that inherits from WebContents, and +// have the concrete TestWebContents inherit from it as well as from +// WebContentsImpl. This approach was discarded as it introduces a diamond +// inheritance pattern, which means we wouldn't be e.g. able to downcast from +// WebContents to WebContentsImpl using static_cast. // -// b) Define a TestWebContents interface that inherits from -// WebContents, and have the concrete TestWebContents implement it, -// using composition of a content::WebContentsImpl to implement most -// methods. This approach was discarded as there is a fundamental -// assumption in content/ that a WebContents* can be downcast to a -// WebContentsImpl*, and this wouldn't be true for TestWebContents +// b) Define a TestWebContents interface that inherits from WebContents, and +// have the concrete TestWebContents implement it, using composition of a +// WebContentsImpl to implement most methods. This approach was discarded as +// there is a fundamental assumption in content/ that a WebContents* can be +// downcast to a WebContentsImpl*, and this wouldn't be true for TestWebContents // objects. class WebContentsTester { public: - // Retrieves a WebContentsTester to drive tests of the specified - // WebContents. As noted above you need to be sure the 'contents' - // object supports testing, i.e. is either created using one of the - // Create... functions below, or is retrieved via - // RenderViewHostTestHarness::GetWebContents(). + // Retrieves a WebContentsTester to drive tests of the specified WebContents. + // As noted above you need to be sure the 'contents' object supports testing, + // i.e. is either created using one of the Create... functions below, or is + // retrieved via RenderViewHostTestHarness::GetWebContents(). static WebContentsTester* For(WebContents* contents); // Creates a WebContents enabled for testing. @@ -87,7 +82,7 @@ class WebContentsTester { // in question have been made. virtual int GetNumberOfFocusCalls() = 0; - virtual content::RenderViewHost* GetPendingRenderViewHost() const = 0; + virtual RenderViewHost* GetPendingRenderViewHost() const = 0; // Creates a pending navigation to the given URL with the default parameters // and then commits the load with a page ID one larger than any seen. This @@ -102,17 +97,17 @@ class WebContentsTester { // Does nothing if no cross-navigation is pending. virtual void ProceedWithCrossSiteNavigation() = 0; - virtual void TestDidNavigate(content::RenderViewHost* render_view_host, + virtual void TestDidNavigate(RenderViewHost* render_view_host, int page_id, const GURL& url, - content::PageTransition transition) = 0; + PageTransition transition) = 0; virtual void TestDidNavigateWithReferrer( - content::RenderViewHost* render_view_host, + RenderViewHost* render_view_host, int page_id, const GURL& url, - const content::Referrer& referrer, - content::PageTransition transition) = 0; + const Referrer& referrer, + PageTransition transition) = 0; // Promote GetWebkitPrefs to public. virtual webkit_glue::WebPreferences TestGetWebkitPrefs() = 0; @@ -120,4 +115,4 @@ class WebContentsTester { } // namespace content -#endif // CONTENT_TEST_WEB_CONTENTS_TESTER_H_ +#endif // CONTENT_PUBLIC_TEST_WEB_CONTENTS_TESTER_H_ diff --git a/content/test/run_all_unittests.cc b/content/test/run_all_unittests.cc index 1c3c576..695cebe 100644 --- a/content/test/run_all_unittests.cc +++ b/content/test/run_all_unittests.cc @@ -3,8 +3,9 @@ // found in the LICENSE file. #include "content/test/content_test_suite.h" -#include "content/test/unittest_test_suite.h" +#include "content/public/test/unittest_test_suite.h" int main(int argc, char** argv) { - return UnitTestTestSuite(new content::ContentTestSuite(argc, argv)).Run(); + return content::UnitTestTestSuite( + new content::ContentTestSuite(argc, argv)).Run(); } diff --git a/content/test/test_renderer_host.cc b/content/test/test_renderer_host.cc index 0638eee..ee1adf2 100644 --- a/content/test/test_renderer_host.cc +++ b/content/test/test_renderer_host.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/test/test_renderer_host.h" +#include "content/public/test/test_renderer_host.h" #include "content/browser/renderer_host/render_view_host_factory.h" #include "content/browser/renderer_host/test_render_view_host.h" diff --git a/content/test/test_url_fetcher_factory.cc b/content/test/test_url_fetcher_factory.cc index 00f9eda..5f174e5 100644 --- a/content/test/test_url_fetcher_factory.cc +++ b/content/test/test_url_fetcher_factory.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/test/test_url_fetcher_factory.h" +#include "content/public/test/test_url_fetcher_factory.h" #include <string> diff --git a/content/test/unittest_test_suite.cc b/content/test/unittest_test_suite.cc index 790e2b8..85597d5 100644 --- a/content/test/unittest_test_suite.cc +++ b/content/test/unittest_test_suite.cc @@ -2,13 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/test/unittest_test_suite.h" +#include "content/public/test/unittest_test_suite.h" #include "base/logging.h" #include "base/test/test_suite.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h" +namespace content { + // A stubbed out WebKit platform support impl. class UnitTestTestSuite::UnitTestWebKitPlatformSupport : public WebKit::WebKitPlatformSupport { @@ -41,3 +43,5 @@ UnitTestTestSuite::~UnitTestTestSuite() { int UnitTestTestSuite::Run() { return test_suite_->Run(); } + +} // namespace content diff --git a/content/test/web_contents_tester.cc b/content/test/web_contents_tester.cc index e6c9a2a..c640311 100644 --- a/content/test/web_contents_tester.cc +++ b/content/test/web_contents_tester.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/test/web_contents_tester.h" +#include "content/public/test/web_contents_tester.h" #include "content/browser/web_contents/test_web_contents.h" |