diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-02 23:15:28 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-02 23:15:28 +0000 |
commit | d22712cbdf27d665a0fc68aed718d7d4f1040511 (patch) | |
tree | 210c2260ef428045f0f95189d142b0097338dee6 /chrome/browser | |
parent | b9541f3f87dd0edc6939cfaf38e1d87ae574f3fe (diff) | |
download | chromium_src-d22712cbdf27d665a0fc68aed718d7d4f1040511.zip chromium_src-d22712cbdf27d665a0fc68aed718d7d4f1040511.tar.gz chromium_src-d22712cbdf27d665a0fc68aed718d7d4f1040511.tar.bz2 |
Reenable IncognitoSplitMode with a hopeful fix.
I believe what was happening was this:
- I had 2 ResultCatchers, one per profile.
- I would call GetNextResult on profile A, which would spin up a nested
message loop.
- We would get a response for profile B, which would quit the nested message
loop.
- ResultCatcher A is confused because he has no results - B got them.
BUG=53991
TEST=no
Review URL: http://codereview.chromium.org/3340004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58422 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/extensions/extension_apitest.cc | 14 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_apitest.h | 4 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_incognito_apitest.cc | 3 |
3 files changed, 15 insertions, 6 deletions
diff --git a/chrome/browser/extensions/extension_apitest.cc b/chrome/browser/extensions/extension_apitest.cc index c5e1f54..005bff0 100644 --- a/chrome/browser/extensions/extension_apitest.cc +++ b/chrome/browser/extensions/extension_apitest.cc @@ -12,7 +12,8 @@ #include "chrome/test/ui_test_utils.h" ExtensionApiTest::ResultCatcher::ResultCatcher() - : profile_restriction_(NULL) { + : profile_restriction_(NULL), + waiting_(false) { registrar_.Add(this, NotificationType::EXTENSION_TEST_PASSED, NotificationService::AllSources()); registrar_.Add(this, NotificationType::EXTENSION_TEST_FAILED, @@ -27,8 +28,11 @@ bool ExtensionApiTest::ResultCatcher::GetNextResult() { // to RunMessageLoop(), so we maintain a queue of results and just pull them // off as the test calls this, going to the run loop only when the queue is // empty. - if (results_.empty()) + if (results_.empty()) { + waiting_ = true; ui_test_utils::RunMessageLoop(); + waiting_ = false; + } if (!results_.empty()) { bool ret = results_.front(); @@ -55,14 +59,16 @@ void ExtensionApiTest::ResultCatcher::Observe( std::cout << "Got EXTENSION_TEST_PASSED notification.\n"; results_.push_back(true); messages_.push_back(""); - MessageLoopForUI::current()->Quit(); + if (waiting_) + MessageLoopForUI::current()->Quit(); break; case NotificationType::EXTENSION_TEST_FAILED: std::cout << "Got EXTENSION_TEST_FAILED notification.\n"; results_.push_back(false); messages_.push_back(*(Details<std::string>(details).ptr())); - MessageLoopForUI::current()->Quit(); + if (waiting_) + MessageLoopForUI::current()->Quit(); break; default: diff --git a/chrome/browser/extensions/extension_apitest.h b/chrome/browser/extensions/extension_apitest.h index 1c20bab..dd56a10 100644 --- a/chrome/browser/extensions/extension_apitest.h +++ b/chrome/browser/extensions/extension_apitest.h @@ -59,6 +59,10 @@ class ExtensionApiTest : public ExtensionBrowserTest { // If non-NULL, we will listen to events from this profile only. Profile* profile_restriction_; + + // True if we're in a nested message loop waiting for results from + // the extension. + bool waiting_; }; // Load |extension_name| and wait for pass / fail notification. diff --git a/chrome/browser/extensions/extension_incognito_apitest.cc b/chrome/browser/extensions/extension_incognito_apitest.cc index 8def903..41ddb99 100644 --- a/chrome/browser/extensions/extension_incognito_apitest.cc +++ b/chrome/browser/extensions/extension_incognito_apitest.cc @@ -97,8 +97,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Incognito) { // Tests that the APIs in an incognito-enabled split-mode extension work // properly. -// Hanging/failing: http://crbug.com/53991 -IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_IncognitoSplitMode) { +IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoSplitMode) { host_resolver()->AddRule("*", "127.0.0.1"); ASSERT_TRUE(test_server()->Start()); |