OLD | NEW |
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 Loading... |
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 Loading... |
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) |
OLD | NEW |