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

Unified Diff: chrome/browser/ui/bookmarks/bookmark_unittest.cc

Issue 12217127: Alternate NTP: Show detached bookmark bar (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix android build Created 7 years, 10 months 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/bookmarks/bookmark_tab_helper.cc ('k') | chrome/browser/ui/webui/ntp/new_tab_ui.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/bookmarks/bookmark_unittest.cc
diff --git a/chrome/browser/ui/bookmarks/bookmark_unittest.cc b/chrome/browser/ui/bookmarks/bookmark_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..65d1c3ca51dd693c980d556d4bdbb9b776eb82a4
--- /dev/null
+++ b/chrome/browser/ui/bookmarks/bookmark_unittest.cc
@@ -0,0 +1,48 @@
+// Copyright (c) 2013 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_service.h"
+#include "chrome/browser/search_engines/template_url_service_factory.h"
+#include "chrome/browser/ui/search/search.h"
+#include "chrome/common/url_constants.h"
+#include "chrome/test/base/browser_with_test_window_test.h"
+
+typedef BrowserWithTestWindowTest BookmarkTest;
+
+// Verify that the detached bookmark bar is visible on the new tab page.
+TEST_F(BookmarkTest, DetachedBookmarkBarOnNTP) {
+ AddTab(browser(), GURL(chrome::kChromeUINewTabURL));
+ EXPECT_EQ(BookmarkBar::DETACHED, browser()->bookmark_bar_state());
+}
+
+class BookmarkInstantExtendedTest : public BrowserWithTestWindowTest {
+ public:
+ BookmarkInstantExtendedTest() {
+ chrome::search::EnableInstantExtendedAPIForTesting();
+ }
+
+ protected:
+ virtual TestingProfile* CreateProfile() OVERRIDE {
+ TestingProfile* profile = BrowserWithTestWindowTest::CreateProfile();
+ // TemplateURLService is normally NULL during testing. Instant extended
+ // needs this service so set a custom factory function.
+ TemplateURLServiceFactory::GetInstance()->SetTestingFactory(
+ profile, &BookmarkInstantExtendedTest::CreateTemplateURLService);
+ return profile;
+ }
+
+ private:
+ static ProfileKeyedService* CreateTemplateURLService(Profile* profile) {
+ return new TemplateURLService(profile);
+ }
+
+ DISALLOW_COPY_AND_ASSIGN(BookmarkInstantExtendedTest);
+};
+
+// Verify that in instant extended mode the detached bookmark bar is visible on
+// the new tab page.
+TEST_F(BookmarkInstantExtendedTest, DetachedBookmarkBarOnNTP) {
+ AddTab(browser(), GURL(chrome::kChromeUINewTabURL));
+ EXPECT_EQ(BookmarkBar::DETACHED, browser()->bookmark_bar_state());
+}
« no previous file with comments | « chrome/browser/ui/bookmarks/bookmark_tab_helper.cc ('k') | chrome/browser/ui/webui/ntp/new_tab_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698