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

Side by Side Diff: chrome/browser/ui/search/search_tab_helper_unittest.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/search/search_tab_helper.h" 5 #include "chrome/browser/ui/search/search_tab_helper.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory>
9 #include <string> 10 #include <string>
10 #include <tuple> 11 #include <tuple>
11 12
12 #include "base/command_line.h" 13 #include "base/command_line.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/metrics/field_trial.h" 14 #include "base/metrics/field_trial.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "chrome/browser/prerender/prerender_manager.h" 17 #include "chrome/browser/prerender/prerender_manager.h"
18 #include "chrome/browser/prerender/prerender_manager_factory.h" 18 #include "chrome/browser/prerender/prerender_manager_factory.h"
19 #include "chrome/browser/search/instant_unittest_base.h" 19 #include "chrome/browser/search/instant_unittest_base.h"
20 #include "chrome/browser/search/search.h" 20 #include "chrome/browser/search/search.h"
21 #include "chrome/browser/search_engines/template_url_service_factory.h" 21 #include "chrome/browser/search_engines/template_url_service_factory.h"
22 #include "chrome/browser/signin/fake_signin_manager_builder.h" 22 #include "chrome/browser/signin/fake_signin_manager_builder.h"
23 #include "chrome/browser/signin/signin_manager_factory.h" 23 #include "chrome/browser/signin/signin_manager_factory.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 process()->sink().ClearMessages(); 146 process()->sink().ClearMessages();
147 EXPECT_CALL(*mock_delegate(), OnInstantSupportDetermined(true)).Times(1); 147 EXPECT_CALL(*mock_delegate(), OnInstantSupportDetermined(true)).Times(1);
148 148
149 SearchTabHelper* search_tab_helper = 149 SearchTabHelper* search_tab_helper =
150 SearchTabHelper::FromWebContents(web_contents()); 150 SearchTabHelper::FromWebContents(web_contents());
151 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); 151 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper);
152 search_tab_helper->ipc_router().set_delegate_for_testing(mock_delegate()); 152 search_tab_helper->ipc_router().set_delegate_for_testing(mock_delegate());
153 search_tab_helper->DetermineIfPageSupportsInstant(); 153 search_tab_helper->DetermineIfPageSupportsInstant();
154 ASSERT_TRUE(MessageWasSent(ChromeViewMsg_DetermineIfPageSupportsInstant::ID)); 154 ASSERT_TRUE(MessageWasSent(ChromeViewMsg_DetermineIfPageSupportsInstant::ID));
155 155
156 scoped_ptr<IPC::Message> response( 156 std::unique_ptr<IPC::Message> response(
157 new ChromeViewHostMsg_InstantSupportDetermined( 157 new ChromeViewHostMsg_InstantSupportDetermined(
158 web_contents()->GetRoutingID(), 158 web_contents()->GetRoutingID(),
159 search_tab_helper->ipc_router().page_seq_no_for_testing(), 159 search_tab_helper->ipc_router().page_seq_no_for_testing(), true));
160 true));
161 search_tab_helper->ipc_router().OnMessageReceived(*response); 160 search_tab_helper->ipc_router().OnMessageReceived(*response);
162 } 161 }
163 162
164 TEST_F(SearchTabHelperTest, PageURLDoesntBelongToInstantRenderer) { 163 TEST_F(SearchTabHelperTest, PageURLDoesntBelongToInstantRenderer) {
165 // Navigate to a page URL that doesn't belong to Instant renderer. 164 // Navigate to a page URL that doesn't belong to Instant renderer.
166 // SearchTabHelper::DeterminerIfPageSupportsInstant() should return 165 // SearchTabHelper::DeterminerIfPageSupportsInstant() should return
167 // immediately without dispatching any message to the renderer. 166 // immediately without dispatching any message to the renderer.
168 NavigateAndCommit(GURL("http://www.example.com")); 167 NavigateAndCommit(GURL("http://www.example.com"));
169 process()->sink().ClearMessages(); 168 process()->sink().ClearMessages();
170 EXPECT_CALL(*mock_delegate(), OnInstantSupportDetermined(false)).Times(0); 169 EXPECT_CALL(*mock_delegate(), OnInstantSupportDetermined(false)).Times(0);
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 } 453 }
455 454
456 TEST_F(SearchTabHelperPrerenderTest, 455 TEST_F(SearchTabHelperPrerenderTest,
457 OnTabActivatedNoPrerenderIfOmniboxBlurred) { 456 OnTabActivatedNoPrerenderIfOmniboxBlurred) {
458 SearchTabHelperPrerenderTest::omnibox_has_focus_ = false; 457 SearchTabHelperPrerenderTest::omnibox_has_focus_ = false;
459 SearchTabHelper* search_tab_helper = 458 SearchTabHelper* search_tab_helper =
460 SearchTabHelper::FromWebContents(web_contents()); 459 SearchTabHelper::FromWebContents(web_contents());
461 search_tab_helper->OnTabActivated(); 460 search_tab_helper->OnTabActivated();
462 ASSERT_FALSE(IsInstantURLMarkedForPrerendering()); 461 ASSERT_FALSE(IsInstantURLMarkedForPrerendering());
463 } 462 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/search_tab_helper.cc ('k') | chrome/browser/ui/search_engines/keyword_editor_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698