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

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

Issue 8618001: Get rid of the EnableClose() infrastructure in Widget. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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
Index: chrome/browser/ui/views/first_run_search_engine_view_unittest.cc
===================================================================
--- chrome/browser/ui/views/first_run_search_engine_view_unittest.cc (revision 0)
+++ chrome/browser/ui/views/first_run_search_engine_view_unittest.cc (revision 0)
@@ -0,0 +1,47 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#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/browser/ui/views/first_run_search_engine_view.h"
sky 2011/11/22 00:37:33 nit: include this first (just like for first_run_s
+#include "chrome/test/base/testing_profile.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/views/focus/accelerator_handler.h"
+#include "ui/views/test/views_test_base.h"
+#include "views/widget/widget.h"
+
+typedef public views::ViewsTestBase FirstRunSearchEngineViewTest;
+
+TEST_F(FirstRunSearchEngineViewTest, ClosingSelectsFirstEngine) {
+ // Create the first run search engine selector, and just close the window.
+ // The first engine in the vector returned by GetTemplateURLs should be set as
+ // the default engine.
+ TestingProfile profile;
+ profile.CreateTemplateURLService();
+ profile.BlockUntilTemplateURLServiceLoaded();
+
+ // Set a dummy provider as the default so we can verify something changed.
sky 2011/11/22 00:37:33 Should you have: EXPECT_NE(d3, service->GetDefault
+ TemplateURLService* service =
+ TemplateURLServiceFactory::GetForProfile(&profile);
+ TemplateURL* d1 = new TemplateURL;
sky 2011/11/22 00:37:33 ASSERT_TRUE(service != NULL);
+ TemplateURL* d2 = new TemplateURL;
+ TemplateURL* d3 = new TemplateURL;
+ service->Add(d1);
+ service->Add(d2);
+ service->Add(d3);
+ service->SetDefaultSearchProvider(d3);
+
+ FirstRunSearchEngineView* contents =
+ new FirstRunSearchEngineView(&profile, false);
+ contents->set_quit_on_closing(false);
+ views::Widget* window = views::Widget::CreateWindow(contents);
+ window->Show();
+ window->Close();
+ RunPendingMessages(); // Allows the window to be destroyed after Close();
+
+ TemplateURLService::TemplateURLVector template_urls =
+ service->GetTemplateURLs();
sky 2011/11/22 00:37:33 ASSERT_TRUE(!template_urls.empty())
+ EXPECT_EQ(template_urls.front(), service->GetDefaultSearchProvider());
+}
Property changes on: chrome\browser\ui\views\first_run_search_engine_view_unittest.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/browser/ui/views/first_run_search_engine_view.cc ('k') | chrome/browser/ui/views/frame/app_panel_browser_frame_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698