summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-08 23:07:08 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-08 23:07:08 +0000
commit0ba6f54e6f4cacbf58cf21444457130fbc5556fb (patch)
treec58dc8fcdeae96121fc4b21bfb0cd4b01344d537
parent3c8466f5a1bed3699980684243c43ff03c2130ee (diff)
downloadchromium_src-0ba6f54e6f4cacbf58cf21444457130fbc5556fb.zip
chromium_src-0ba6f54e6f4cacbf58cf21444457130fbc5556fb.tar.gz
chromium_src-0ba6f54e6f4cacbf58cf21444457130fbc5556fb.tar.bz2
Fixes for the flakiness in the chrome frame net tests run seen on the per user IE8 builder.
The flakiness occurs because IE starts up before chrome_frame_helper which results in a failure to register a BHO for the IE window. Fix is to make the ChromeFrame registrar object a member of the chrome frame net test suite. Rearranged some code which ensures that we can now run chrome_frame_net_tests in debug builds without annoying DCHECKs BUG=none TEST=chrome frame net tests. Review URL: http://codereview.chromium.org/6650003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77362 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome_frame/test/net/fake_external_tab.cc9
-rw-r--r--chrome_frame/test/net/fake_external_tab.h2
-rw-r--r--chrome_frame/test/perf/run_all.cc6
-rw-r--r--chrome_frame/test/run_all_unittests.cc3
-rw-r--r--chrome_frame/test_utils.cc16
-rw-r--r--chrome_frame/test_utils.h3
6 files changed, 26 insertions, 13 deletions
diff --git a/chrome_frame/test/net/fake_external_tab.cc b/chrome_frame/test/net/fake_external_tab.cc
index fe3cc03e..c1deec2 100644
--- a/chrome_frame/test/net/fake_external_tab.cc
+++ b/chrome_frame/test/net/fake_external_tab.cc
@@ -36,7 +36,6 @@
#include "chrome_frame/test/chrome_frame_test_utils.h"
#include "chrome_frame/test/net/test_automation_resource_message_filter.h"
#include "chrome_frame/test/simulate_input.h"
-#include "chrome_frame/test_utils.h"
#include "chrome_frame/test/win_event_receiver.h"
#include "chrome_frame/utils.h"
#include "content/browser/plugin_service.h"
@@ -193,7 +192,6 @@ void FakeExternalTab::Initialize() {
icu_util::Initialize();
- chrome::RegisterPathProvider();
app::RegisterPathProvider();
ui::RegisterPathProvider();
@@ -255,7 +253,8 @@ void FakeExternalTab::Shutdown() {
CFUrlRequestUnittestRunner::CFUrlRequestUnittestRunner(int argc, char** argv)
: NetTestSuite(argc, argv),
- chrome_frame_html_("/chrome_frame", kChromeFrameHtml) {
+ chrome_frame_html_("/chrome_frame", kChromeFrameHtml),
+ registrar_(chrome_frame_test::GetTestBedType()) {
// Register the main thread by instantiating it, but don't call any methods.
main_thread_.reset(new BrowserThread(BrowserThread::UI,
MessageLoop::current()));
@@ -511,10 +510,6 @@ int main(int argc, char** argv) {
// below require. So we have to instantiate this first.
CFUrlRequestUnittestRunner test_suite(argc, argv);
- // Register paths needed by the ScopedChromeFrameRegistrar.
- chrome::RegisterPathProvider();
- ScopedChromeFrameRegistrar registrar(chrome_frame_test::GetTestBedType());
-
WindowWatchdog watchdog;
// See url_request_unittest.cc for these credentials.
SupplyProxyCredentials credentials("user", "secret");
diff --git a/chrome_frame/test/net/fake_external_tab.h b/chrome_frame/test/net/fake_external_tab.h
index 5bb3ef4..b570fea 100644
--- a/chrome_frame/test/net/fake_external_tab.h
+++ b/chrome_frame/test/net/fake_external_tab.h
@@ -13,6 +13,7 @@
#include "base/win/scoped_handle.h"
#include "chrome/app/scoped_ole_initializer.h"
#include "chrome/browser/browser_process_impl.h"
+#include "chrome_frame/test_utils.h"
#include "chrome_frame/test/test_server.h"
#include "chrome_frame/test/net/test_automation_provider.h"
#include "chrome_frame/test/net/process_singleton_subclass.h"
@@ -98,6 +99,7 @@ class CFUrlRequestUnittestRunner
FakeExternalTab fake_chrome_;
scoped_ptr<ProcessSingletonSubclass> pss_subclass_;
scoped_ptr<BrowserThread> main_thread_;
+ ScopedChromeFrameRegistrar registrar_;
};
#endif // CHROME_FRAME_TEST_NET_FAKE_EXTERNAL_TAB_H_
diff --git a/chrome_frame/test/perf/run_all.cc b/chrome_frame/test/perf/run_all.cc
index 3b29280..10e7dd1 100644
--- a/chrome_frame/test/perf/run_all.cc
+++ b/chrome_frame/test/perf/run_all.cc
@@ -16,7 +16,6 @@ void PureCall() {
int main(int argc, char **argv) {
base::PerfTestSuite perf_suite(argc, argv);
- chrome::RegisterPathProvider();
base::PlatformThread::SetName("ChromeFrame perf tests");
_set_purecall_handler(PureCall);
@@ -24,12 +23,13 @@ int main(int argc, char **argv) {
SetConfigBool(kChromeFrameHeadlessMode, true);
SetConfigBool(kChromeFrameUnpinnedMode, true);
- base::ProcessHandle crash_service = chrome_frame_test::StartCrashService();
-
// Use ctor/raii to register the local Chrome Frame dll.
scoped_ptr<ScopedChromeFrameRegistrar> registrar(
new ScopedChromeFrameRegistrar(
ScopedChromeFrameRegistrar::SYSTEM_LEVEL));
+
+ base::ProcessHandle crash_service = chrome_frame_test::StartCrashService();
+
int ret = perf_suite.Run();
DeleteConfigValue(kChromeFrameHeadlessMode);
diff --git a/chrome_frame/test/run_all_unittests.cc b/chrome_frame/test/run_all_unittests.cc
index 54129a2..49957b9 100644
--- a/chrome_frame/test/run_all_unittests.cc
+++ b/chrome_frame/test/run_all_unittests.cc
@@ -72,9 +72,6 @@ int main(int argc, char **argv) {
if (CommandLine::ForCurrentProcess()->HasSwitch(kNoRegistrationSwitch)) {
ret = test_suite.Run();
} else {
- // Register paths needed by the ScopedChromeFrameRegistrar.
- chrome::RegisterPathProvider();
-
// This will register the chrome frame in the build directory. It currently
// leaves that chrome frame registered once the tests are done. It must be
// constructed AFTER the TestSuite is created since TestSuites create THE
diff --git a/chrome_frame/test_utils.cc b/chrome_frame/test_utils.cc
index 258b0fa..14149ab 100644
--- a/chrome_frame/test_utils.cc
+++ b/chrome_frame/test_utils.cc
@@ -45,8 +45,14 @@ FilePath GetChromeFrameBuildPath() {
return dll_path;
}
+bool ScopedChromeFrameRegistrar::register_chrome_path_provider_ = false;;
+
// static
void ScopedChromeFrameRegistrar::RegisterDefaults() {
+ if (!register_chrome_path_provider_) {
+ chrome::RegisterPathProvider();
+ register_chrome_path_provider_ = true;
+ }
FilePath dll_path = GetChromeFrameBuildPath();
RegisterAtPath(dll_path.value(), chrome_frame_test::GetTestBedType());
}
@@ -148,6 +154,11 @@ FilePath ScopedChromeFrameRegistrar::GetReferenceChromeFrameDllPath() {
ScopedChromeFrameRegistrar::ScopedChromeFrameRegistrar(
const std::wstring& path, RegistrationType registration_type)
: registration_type_(registration_type) {
+ if (!register_chrome_path_provider_) {
+ // Register paths needed by the ScopedChromeFrameRegistrar.
+ chrome::RegisterPathProvider();
+ register_chrome_path_provider_ = true;
+ }
original_dll_path_ = path;
RegisterChromeFrameAtPath(original_dll_path_);
}
@@ -155,6 +166,11 @@ ScopedChromeFrameRegistrar::ScopedChromeFrameRegistrar(
ScopedChromeFrameRegistrar::ScopedChromeFrameRegistrar(
RegistrationType registration_type)
: registration_type_(registration_type) {
+ if (!register_chrome_path_provider_) {
+ // Register paths needed by the ScopedChromeFrameRegistrar.
+ chrome::RegisterPathProvider();
+ register_chrome_path_provider_ = true;
+ }
original_dll_path_ = GetChromeFrameBuildPath().value();
RegisterChromeFrameAtPath(original_dll_path_);
}
diff --git a/chrome_frame/test_utils.h b/chrome_frame/test_utils.h
index 7b66083..8787964 100644
--- a/chrome_frame/test_utils.h
+++ b/chrome_frame/test_utils.h
@@ -57,6 +57,9 @@ class ScopedChromeFrameRegistrar {
// Indicates whether per user or per machine registration is needed.
RegistrationType registration_type_;
+ // We need to register the chrome path provider only once per process. This
+ // flag keeps track of that.
+ static bool register_chrome_path_provider_;
};
// Returns the path to the Chrome Frame DLL in the build directory. Assumes