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

Side by Side Diff: chrome/browser/rlz/rlz_unittest.cc

Issue 1156023006: Bring RFH/RVH unit tests closer to reality of how RF/RV are initialized (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move InitializeRenderFrameIfNeeded to RenderFrameHostTester and fix RlzLibTest code. Created 5 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/rlz/rlz.h" 5 #include "chrome/browser/rlz/rlz.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "chrome/browser/autocomplete/autocomplete_controller.h" 10 #include "chrome/browser/autocomplete/autocomplete_controller.h"
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 content::Details<OmniboxLog>(&dummy)); 264 content::Details<OmniboxLog>(&dummy));
265 } 265 }
266 266
267 void RlzLibTest::SimulateHomepageUsage() { 267 void RlzLibTest::SimulateHomepageUsage() {
268 GURL home_url = GURL("https://www.google.com/"); 268 GURL home_url = GURL("https://www.google.com/");
269 GURL search_url = GURL("https://www.google.com/#q=search"); 269 GURL search_url = GURL("https://www.google.com/#q=search");
270 270
271 content::RenderFrameHostTester* rfht = 271 content::RenderFrameHostTester* rfht =
272 content::RenderFrameHostTester::For(main_rfh()); 272 content::RenderFrameHostTester::For(main_rfh());
273 273
274 // Ensure the RenderFrame is initialized before simulating events coming from
275 // it.
276 rfht->InitializeRenderFrameIfNeeded();
277
274 // Simulate a navigation to homepage first. 278 // Simulate a navigation to homepage first.
275 rfht->SendNavigateWithTransition( 279 rfht->SendNavigateWithTransition(
276 0, 0, true, home_url, ui::PAGE_TRANSITION_HOME_PAGE); 280 0, 0, true, home_url, ui::PAGE_TRANSITION_HOME_PAGE);
277 // Then simulate a search from homepage. 281 // Then simulate a search from homepage.
278 rfht->SendNavigateWithTransition( 282 rfht->SendNavigateWithTransition(
279 1, 0, true, search_url, ui::PAGE_TRANSITION_LINK); 283 1, 0, true, search_url, ui::PAGE_TRANSITION_LINK);
280 } 284 }
281 285
282 void RlzLibTest::SimulateAppListUsage() { 286 void RlzLibTest::SimulateAppListUsage() {
283 RLZTracker::RecordAppListSearch(); 287 RLZTracker::RecordAppListSearch();
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 RLZTracker::RecordProductEvent(rlz_lib::CHROME, RLZTracker::ChromeOmnibox(), 914 RLZTracker::RecordProductEvent(rlz_lib::CHROME, RLZTracker::ChromeOmnibox(),
911 rlz_lib::FIRST_SEARCH); 915 rlz_lib::FIRST_SEARCH);
912 916
913 ExpectEventRecorded(kOmniboxFirstSearch, true); 917 ExpectEventRecorded(kOmniboxFirstSearch, true);
914 918
915 RLZTracker::ClearRlzState(); 919 RLZTracker::ClearRlzState();
916 920
917 ExpectEventRecorded(kOmniboxFirstSearch, false); 921 ExpectEventRecorded(kOmniboxFirstSearch, false);
918 } 922 }
919 #endif // defined(OS_CHROMEOS) 923 #endif // defined(OS_CHROMEOS)
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698