summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-04 06:08:09 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-04 06:08:09 +0000
commit7d855a1eaf67b1de236bdf251773211bada6301b (patch)
tree04d581f0aeb9481ef5b3ae829d2f156a27299c5a /content
parente7cfd32e14c02fdf1436545c39b68ecc08c35611 (diff)
downloadchromium_src-7d855a1eaf67b1de236bdf251773211bada6301b.zip
chromium_src-7d855a1eaf67b1de236bdf251773211bada6301b.tar.gz
chromium_src-7d855a1eaf67b1de236bdf251773211bada6301b.tar.bz2
Move test headers from content\test 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/10502009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140261 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/web_contents/navigation_controller_impl_unittest.cc3
-rw-r--r--content/browser/web_contents/render_view_host_manager_unittest.cc6
-rw-r--r--content/content_tests.gypi8
-rw-r--r--content/public/test/test_content_client_initializer.h (renamed from content/test/test_content_client_initializer.h)8
-rw-r--r--content/public/test/test_file_error_injector.h (renamed from content/test/test_file_error_injector.h)14
-rw-r--r--content/public/test/test_launcher.h (renamed from content/test/test_launcher.h)6
-rw-r--r--content/public/test/test_notification_tracker.h (renamed from content/test/test_notification_tracker.h)26
-rw-r--r--content/test/content_test_launcher.cc2
-rw-r--r--content/test/content_test_suite.cc2
-rw-r--r--content/test/test_content_client_initializer.cc12
-rw-r--r--content/test/test_file_error_injector.cc2
-rw-r--r--content/test/test_launcher.cc2
-rw-r--r--content/test/test_notification_tracker.cc22
13 files changed, 61 insertions, 52 deletions
diff --git a/content/browser/web_contents/navigation_controller_impl_unittest.cc b/content/browser/web_contents/navigation_controller_impl_unittest.cc
index 6c7af35..f3b9560 100644
--- a/content/browser/web_contents/navigation_controller_impl_unittest.cc
+++ b/content/browser/web_contents/navigation_controller_impl_unittest.cc
@@ -28,7 +28,7 @@
#include "content/public/browser/notification_types.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/test/mock_render_process_host.h"
-#include "content/test/test_notification_tracker.h"
+#include "content/public/test/test_notification_tracker.h"
#include "net/base/net_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webkit/glue/webkit_glue.h"
@@ -39,6 +39,7 @@ using content::NavigationEntry;
using content::NavigationEntryImpl;
using content::RenderViewHostImplTestHarness;
using content::SiteInstance;
+using content::TestNotificationTracker;
using content::TestRenderViewHost;
using content::TestWebContents;
using content::WebContents;
diff --git a/content/browser/web_contents/render_view_host_manager_unittest.cc b/content/browser/web_contents/render_view_host_manager_unittest.cc
index eb78332..fd94166 100644
--- a/content/browser/web_contents/render_view_host_manager_unittest.cc
+++ b/content/browser/web_contents/render_view_host_manager_unittest.cc
@@ -23,8 +23,8 @@
#include "content/public/common/url_constants.h"
#include "content/public/test/mock_render_process_host.h"
#include "content/public/test/test_browser_context.h"
+#include "content/public/test/test_notification_tracker.h"
#include "content/test/test_content_client.h"
-#include "content/test/test_notification_tracker.h"
#include "googleurl/src/url_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webkit/glue/webkit_glue.h"
@@ -407,7 +407,7 @@ TEST_F(RenderViewHostManagerTest, Init) {
// Tests the Navigate function. We navigate three sites consecutively and check
// how the pending/committed RenderViewHost are modified.
TEST_F(RenderViewHostManagerTest, Navigate) {
- TestNotificationTracker notifications;
+ content::TestNotificationTracker notifications;
SiteInstance* instance = SiteInstance::Create(browser_context());
@@ -499,7 +499,7 @@ TEST_F(RenderViewHostManagerTest, Navigate) {
// has been committed. This is also a regression test for
// http://crbug.com/104600.
TEST_F(RenderViewHostManagerTest, NavigateWithEarlyReNavigation) {
- TestNotificationTracker notifications;
+ content::TestNotificationTracker notifications;
SiteInstance* instance = SiteInstance::Create(browser_context());
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index f9d04f1..18bc770 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -39,7 +39,10 @@
'public/test/render_view_test.h',
'public/test/test_browser_context.h',
'public/test/test_browser_thread.h',
+ 'public/test/test_content_client_initializer.h',
+ 'public/test/test_file_error_injector.h',
'public/test/test_navigation_observer.h',
+ 'public/test/test_notification_tracker.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).
@@ -98,12 +101,9 @@
'test/test_content_client.cc',
'test/test_content_client.h',
'test/test_content_client_initializer.cc',
- 'test/test_content_client_initializer.h',
'test/test_file_error_injector.cc',
- 'test/test_file_error_injector.h',
'test/test_navigation_observer.cc',
'test/test_notification_tracker.cc',
- 'test/test_notification_tracker.h',
'test/test_renderer_host.cc',
'test/test_renderer_host.h',
'test/test_render_view_host_factory.cc',
@@ -442,11 +442,11 @@
],
'sources': [
'app/startup_helper_win.cc',
+ 'public/test/test_launcher.h',
'test/content_browser_test.h',
'test/content_browser_test.cc',
'test/content_test_launcher.cc',
'test/test_launcher.cc',
- 'test/test_launcher.h',
],
'conditions': [
['OS=="win"', {
diff --git a/content/test/test_content_client_initializer.h b/content/public/test/test_content_client_initializer.h
index 25bee17..4fe5a63 100644
--- a/content/test/test_content_client_initializer.h
+++ b/content/public/test/test_content_client_initializer.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_CONTENT_CLIENT_INITIALIZER_
-#define CONTENT_TEST_TEST_CONTENT_CLIENT_INITIALIZER_
+#ifndef CONTENT_PUBLIC_TEST_TEST_CONTENT_CLIENT_INITIALIZER_
+#define CONTENT_PUBLIC_TEST_TEST_CONTENT_CLIENT_INITIALIZER_
#pragma once
#include "base/basictypes.h"
@@ -26,7 +26,7 @@ class TestContentClientInitializer {
private:
scoped_ptr<NotificationServiceImpl> notification_service_;
- scoped_ptr<content::ContentClient> content_client_;
+ scoped_ptr<ContentClient> content_client_;
scoped_ptr<MockContentBrowserClient> content_browser_client_;
DISALLOW_COPY_AND_ASSIGN(TestContentClientInitializer);
@@ -34,4 +34,4 @@ class TestContentClientInitializer {
} // namespace content
-#endif // CONTENT_TEST_TEST_CONTENT_CLIENT_INITIALIZER_
+#endif // CONTENT_PUBLIC_TEST_TEST_CONTENT_CLIENT_INITIALIZER_
diff --git a/content/test/test_file_error_injector.h b/content/public/test/test_file_error_injector.h
index f5f4978..73a7bb0 100644
--- a/content/test/test_file_error_injector.h
+++ b/content/public/test/test_file_error_injector.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_FILE_ERROR_INJECTOR_H_
-#define CONTENT_TEST_TEST_FILE_ERROR_INJECTOR_H_
+#ifndef CONTENT_PUBLIC_TEST_TEST_FILE_ERROR_INJECTOR_H_
+#define CONTENT_PUBLIC_TEST_TEST_FILE_ERROR_INJECTOR_H_
#pragma once
#include <map>
@@ -97,7 +97,7 @@ class TestFileErrorInjector
bool HadFile(const GURL& url) const;
// Gets the download ID associated with the file matching |url|.
- const content::DownloadId GetId(const GURL& url) const;
+ const DownloadId GetId(const GURL& url) const;
// Resets the found file list.
void ClearFoundFiles();
@@ -107,7 +107,7 @@ class TestFileErrorInjector
private:
friend class base::RefCountedThreadSafe<TestFileErrorInjector>;
- typedef std::map<GURL, content::DownloadId> FileMap;
+ typedef std::map<GURL, DownloadId> FileMap;
TestFileErrorInjector();
@@ -120,11 +120,11 @@ class TestFileErrorInjector
// Callbacks from the download file, to record lifetimes.
// These may be called on any thread.
- void RecordDownloadFileConstruction(const GURL& url, content::DownloadId id);
+ void RecordDownloadFileConstruction(const GURL& url, DownloadId id);
void RecordDownloadFileDestruction(const GURL& url);
// These run on the UI thread.
- void DownloadFileCreated(GURL url, content::DownloadId id);
+ void DownloadFileCreated(GURL url, DownloadId id);
void DestroyingDownloadFile(GURL url);
// All the data is used on the UI thread.
@@ -145,4 +145,4 @@ class TestFileErrorInjector
} // namespace content
-#endif // CONTENT_TEST_TEST_FILE_ERROR_INJECTOR_H_
+#endif // CONTENT_PUBLIC_TEST_TEST_FILE_ERROR_INJECTOR_H_
diff --git a/content/test/test_launcher.h b/content/public/test/test_launcher.h
index 6bc1fb0..4e72b70 100644
--- a/content/test/test_launcher.h
+++ b/content/public/test/test_launcher.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_LAUNCHER_H_
-#define CONTENT_TEST_TEST_LAUNCHER_H_
+#ifndef CONTENT_PUBLIC_TEST_TEST_LAUNCHER_H_
+#define CONTENT_PUBLIC_TEST_TEST_LAUNCHER_H_
#pragma once
#include "base/basictypes.h"
@@ -41,4 +41,4 @@ int LaunchTests(TestLauncherDelegate* launcher_delegate,
} // namespace test_launcher
-#endif // CONTENT_TEST_TEST_LAUNCHER_H_
+#endif // CONTENT_PUBLIC_TEST_TEST_LAUNCHER_H_
diff --git a/content/test/test_notification_tracker.h b/content/public/test/test_notification_tracker.h
index ef1d7ce..934259d 100644
--- a/content/test/test_notification_tracker.h
+++ b/content/public/test/test_notification_tracker.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_NOTIFICATION_TRACKER_H_
-#define CONTENT_TEST_TEST_NOTIFICATION_TRACKER_H_
+#ifndef CONTENT_PUBLIC_TEST_TEST_NOTIFICATION_TRACKER_H_
+#define CONTENT_PUBLIC_TEST_TEST_NOTIFICATION_TRACKER_H_
#pragma once
#include <vector>
@@ -14,18 +14,20 @@
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_source.h"
+namespace content {
+
// Provides an easy way for tests to verify that a given set of notifications
// was received during test execution.
-class TestNotificationTracker : public content::NotificationObserver {
+class TestNotificationTracker : public NotificationObserver {
public:
// Records one received notification.
struct Event {
Event();
- Event(int t, content::NotificationSource s, content::NotificationDetails d);
+ Event(int t, NotificationSource s, NotificationDetails d);
int type;
- content::NotificationSource source;
- content::NotificationDetails details;
+ NotificationSource source;
+ NotificationDetails details;
};
// By default, it won't listen for any notifications. You'll need to call
@@ -35,7 +37,7 @@ class TestNotificationTracker : public content::NotificationObserver {
virtual ~TestNotificationTracker();
// Makes this object listen for the given notification with the given source.
- void ListenFor(int type, const content::NotificationSource& source);
+ void ListenFor(int type, const NotificationSource& source);
// Makes this object listen for notifications of the given type coming from
// any source.
@@ -69,10 +71,10 @@ class TestNotificationTracker : public content::NotificationObserver {
protected:
virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE;
+ const NotificationSource& source,
+ const NotificationDetails& details) OVERRIDE;
private:
- content::NotificationRegistrar registrar_;
+ NotificationRegistrar registrar_;
// Lists all received since last cleared, in the order they were received.
std::vector<Event> events_;
@@ -80,4 +82,6 @@ class TestNotificationTracker : public content::NotificationObserver {
DISALLOW_COPY_AND_ASSIGN(TestNotificationTracker);
};
-#endif // CONTENT_TEST_TEST_NOTIFICATION_TRACKER_H_
+} // namespace content
+
+#endif // CONTENT_PUBLIC_TEST_TEST_NOTIFICATION_TRACKER_H_
diff --git a/content/test/content_test_launcher.cc b/content/test/content_test_launcher.cc
index b646f3e..1e28b1d 100644
--- a/content/test/content_test_launcher.cc
+++ b/content/test/content_test_launcher.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_launcher.h"
+#include "content/public/test/test_launcher.h"
#include "base/base_paths.h"
#include "base/command_line.h"
diff --git a/content/test/content_test_suite.cc b/content/test/content_test_suite.cc
index 36e7229..6b785aa 100644
--- a/content/test/content_test_suite.cc
+++ b/content/test/content_test_suite.cc
@@ -6,8 +6,8 @@
#include "base/logging.h"
#include "content/browser/mock_content_browser_client.h"
+#include "content/public/test/test_content_client_initializer.h"
#include "content/test/test_content_client.h"
-#include "content/test/test_content_client_initializer.h"
#include "testing/gtest/include/gtest/gtest.h"
#if defined(USE_AURA)
diff --git a/content/test/test_content_client_initializer.cc b/content/test/test_content_client_initializer.cc
index 26cd3aa..4623192 100644
--- a/content/test/test_content_client_initializer.cc
+++ b/content/test/test_content_client_initializer.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_content_client_initializer.h"
+#include "content/public/test/test_content_client_initializer.h"
#include "content/browser/mock_content_browser_client.h"
#include "content/browser/notification_service_impl.h"
@@ -14,19 +14,19 @@ namespace content {
TestContentClientInitializer::TestContentClientInitializer() {
notification_service_.reset(new NotificationServiceImpl());
- DCHECK(!content::GetContentClient());
+ DCHECK(!GetContentClient());
content_client_.reset(new TestContentClient);
- content::SetContentClient(content_client_.get());
+ SetContentClient(content_client_.get());
- content_browser_client_.reset(new content::MockContentBrowserClient());
+ content_browser_client_.reset(new MockContentBrowserClient());
content_client_->set_browser(content_browser_client_.get());
}
TestContentClientInitializer::~TestContentClientInitializer() {
notification_service_.reset();
- DCHECK_EQ(content_client_.get(), content::GetContentClient());
- content::SetContentClient(NULL);
+ DCHECK_EQ(content_client_.get(), GetContentClient());
+ SetContentClient(NULL);
content_client_.reset();
content_browser_client_.reset();
diff --git a/content/test/test_file_error_injector.cc b/content/test/test_file_error_injector.cc
index 2364f6a..09d96e0 100644
--- a/content/test/test_file_error_injector.cc
+++ b/content/test/test_file_error_injector.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_file_error_injector.h"
+#include "content/public/test/test_file_error_injector.h"
#include <vector>
diff --git a/content/test/test_launcher.cc b/content/test/test_launcher.cc
index d5eab8a..a59220b 100644
--- a/content/test/test_launcher.cc
+++ b/content/test/test_launcher.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_launcher.h"
+#include "content/public/test/test_launcher.h"
#include <string>
#include <vector>
diff --git a/content/test/test_notification_tracker.cc b/content/test/test_notification_tracker.cc
index 04de93f..bf166e7 100644
--- a/content/test/test_notification_tracker.cc
+++ b/content/test/test_notification_tracker.cc
@@ -2,19 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/test/test_notification_tracker.h"
+#include "content/public/test/test_notification_tracker.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
+namespace content {
+
TestNotificationTracker::Event::Event()
- : type(content::NOTIFICATION_ALL),
- source(content::NotificationService::AllSources()),
- details(content::NotificationService::NoDetails()) {
+ : type(NOTIFICATION_ALL),
+ source(NotificationService::AllSources()),
+ details(NotificationService::NoDetails()) {
}
TestNotificationTracker::Event::Event(int t,
- content::NotificationSource s,
- content::NotificationDetails d)
+ NotificationSource s,
+ NotificationDetails d)
: type(t),
source(s),
details(d) {
@@ -28,7 +30,7 @@ TestNotificationTracker::~TestNotificationTracker() {
void TestNotificationTracker::ListenFor(
int type,
- const content::NotificationSource& source) {
+ const NotificationSource& source) {
registrar_.Add(this, type, source);
}
@@ -73,7 +75,9 @@ bool TestNotificationTracker::Check3AndReset(int type1,
void TestNotificationTracker::Observe(
int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
+ const NotificationSource& source,
+ const NotificationDetails& details) {
events_.push_back(Event(type, source, details));
}
+
+} // namespace content