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

Side by Side Diff: components/search_engines/desktop_search_infobar_delegate_win_unittest.cc

Issue 1598553003: Implement the Windows desktop search redirection feature. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: don't assume that a Browser exists + fix nits Created 4 years, 11 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/search_engines/desktop_search_infobar_delegate_win.h"
6
7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string16.h"
10 #include "components/infobars/core/infobar.h"
11 #include "components/infobars/core/infobar_manager.h"
12 #include "components/search_engines/desktop_search_utils_win.h"
13 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h"
15
16 namespace {
17
18 class MockInfoBarManager : public infobars::InfoBarManager {
19 public:
20 // infobars::InfoBarManager:
21 int GetActiveEntryID() override { return 0; }
22
23 scoped_ptr<infobars::InfoBar> CreateConfirmInfoBar(
24 scoped_ptr<ConfirmInfoBarDelegate> delegate) override {
25 NOTREACHED();
26 return scoped_ptr<infobars::InfoBar>();
27 }
28
29 MOCK_METHOD2(OpenURL,
30 void(const GURL& url, WindowOpenDisposition disposition));
31 };
32
33 const base::char16 kSearchSettingsURL[] = L"chrome://settings/searchEngines";
Peter Kasting 2016/01/20 03:03:02 I wouldn't use the real chrome: URL in a component
fdoray 2016/01/21 21:02:33 Removed the test.
34
35 } // namespace
36
37 TEST(WindowsDesktopSearchInfobarDelegateTest, ManageSearchSettings) {
Peter Kasting 2016/01/20 03:03:02 Does this test really matter? It seems like it's
fdoray 2016/01/21 21:02:33 Removed the test.
38 // Create a Windows desktop search redirection infobar.
39 infobars::InfoBar* infobar =
40 new infobars::InfoBar(scoped_ptr<infobars::InfoBarDelegate>(
Peter Kasting 2016/01/20 03:03:02 Nit: make_scoped_ptr()?
fdoray 2016/01/21 21:02:33 Removed the test.
41 new WindowsDesktopSearchInfobarDelegate(L"Google",
42 GURL(kSearchSettingsURL))));
43 MockInfoBarManager infobar_manager;
44 infobar->SetOwner(&infobar_manager);
45
46 EXPECT_CALL(infobar_manager,
47 OpenURL(GURL(kSearchSettingsURL), NEW_FOREGROUND_TAB));
48 EXPECT_FALSE(infobar->delegate()->AsConfirmInfoBarDelegate()->Accept());
49
50 // This calls the destructor of |infobar|.
51 infobar->CloseSoon();
52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698