Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4173)

Unified Diff: chrome/browser/ui/views/first_run_search_engine_view_unittest.cc

Issue 8790001: Revert 112770 - Prevent a crash in the first run search engine selector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/first_run_search_engine_view.cc ('k') | ui/views/test/views_test_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/first_run_search_engine_view_unittest.cc
===================================================================
--- chrome/browser/ui/views/first_run_search_engine_view_unittest.cc (revision 112803)
+++ chrome/browser/ui/views/first_run_search_engine_view_unittest.cc (working copy)
@@ -7,12 +7,7 @@
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_service.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
-#include "chrome/common/chrome_notification_types.h"
#include "chrome/test/base/testing_profile.h"
-#include "chrome/test/base/ui_test_utils.h"
-#include "content/browser/browser_process_sub_thread.h"
-#include "content/public/browser/notification_service.h"
-#include "content/test/test_browser_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/views/focus/accelerator_handler.h"
#include "ui/views/test/views_test_base.h"
@@ -54,56 +49,3 @@
ASSERT_TRUE(!template_urls.empty());
EXPECT_EQ(template_urls.front(), service->GetDefaultSearchProvider());
}
-
-TEST_F(FirstRunSearchEngineViewTest, ClosingBeforeServiceLoadedAbortsClose) {
- // This ensures the current thread is named the UI thread, so code that checks
- // that this is the UI thread doesn't assert.
- content::TestBrowserThread ui_thread(content::BrowserThread::UI,
- message_loop());
- content::BrowserProcessSubThread db_thread(content::BrowserThread::DB);
- db_thread.StartWithOptions(base::Thread::Options());
-
- TestingProfile profile;
- // We need to initialize the web database before accessing the template url
- // service otherwise the template url service will init itself synchronously
- // and appear to be loaded.
- profile.CreateWebDataService(false);
- profile.CreateTemplateURLService();
-
- // Instead of giving the template url service a chance to load, try and close
- // the window immediately.
- FirstRunSearchEngineView* contents =
- new FirstRunSearchEngineView(&profile, false);
- contents->set_quit_on_closing(false);
- views::Widget* window = views::Widget::CreateWindow(contents);
- window->Show();
- EXPECT_TRUE(window->IsVisible());
- window->Close();
- // The window wouldn't actually be closed until a return to the message loop,
- // which we don't want to spin here because the window shouldn't have closed
- // in the correct case. The window is however actually hidden immediately when
- // the window is allowed to close, so we can test for visibility to make sure
- // it hasn't.
- EXPECT_TRUE(window->IsVisible());
-
- // Now let the template url service a chance to load.
- ui_test_utils::WindowedNotificationObserver service_load_observer(
- chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED,
- content::NotificationService::AllSources());
- service_load_observer.Wait();
-
- // .. and try and close the window. It should be allowed to now.
- window->Close();
- EXPECT_FALSE(window->IsVisible());
-
- // Allow the window to actually close.
- RunPendingMessages();
-
- // Verify goodness. Because we actually went to the trouble of starting the
- // WebDB, we will have real data in the model, so we can verify a choice was
- // made without having to seed the model with dummy data.
- TemplateURLService* service =
- TemplateURLServiceFactory::GetForProfile(&profile);
- ASSERT_TRUE(service != NULL);
- EXPECT_TRUE(service->GetDefaultSearchProvider() != NULL);
-}
« no previous file with comments | « chrome/browser/ui/views/first_run_search_engine_view.cc ('k') | ui/views/test/views_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698