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

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

Issue 291303007: Fix RlzLibTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set back enable_rlz Created 6 years, 7 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 | no next file » | 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"
10 #include "chrome/browser/autocomplete/autocomplete_controller.h"
11 #include "chrome/browser/autocomplete/autocomplete_input.h"
9 #include "chrome/browser/chrome_notification_types.h" 12 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/google/google_util.h" 13 #include "chrome/browser/google/google_util.h"
11 #include "chrome/browser/omnibox/omnibox_log.h" 14 #include "chrome/browser/omnibox/omnibox_log.h"
12 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/installer/util/browser_distribution.h" 16 #include "chrome/installer/util/browser_distribution.h"
14 #include "chrome/installer/util/google_update_constants.h" 17 #include "chrome/installer/util/google_update_constants.h"
15 #include "content/public/browser/navigation_entry.h" 18 #include "content/public/browser/navigation_entry.h"
16 #include "content/public/browser/notification_details.h" 19 #include "content/public/browser/notification_details.h"
17 #include "content/public/browser/notification_service.h" 20 #include "content/public/browser/notification_service.h"
18 #include "content/public/browser/notification_source.h" 21 #include "content/public/browser/notification_source.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 LONG result = key.DeleteValue(name); 226 LONG result = key.DeleteValue(name);
224 ASSERT_TRUE(ERROR_SUCCESS == result || ERROR_FILE_NOT_FOUND == result); 227 ASSERT_TRUE(ERROR_SUCCESS == result || ERROR_FILE_NOT_FOUND == result);
225 } else { 228 } else {
226 base::string16 brand16 = base::ASCIIToUTF16(brand); 229 base::string16 brand16 = base::ASCIIToUTF16(brand);
227 ASSERT_EQ(ERROR_SUCCESS, key.WriteValue(name, brand16.c_str())); 230 ASSERT_EQ(ERROR_SUCCESS, key.WriteValue(name, brand16.c_str()));
228 } 231 }
229 } 232 }
230 #endif 233 #endif
231 234
232 void RlzLibTest::SimulateOmniboxUsage() { 235 void RlzLibTest::SimulateOmniboxUsage() {
236 // Create a dummy OmniboxLog object. The 'is_popup_open' field needs to be
237 // true to trigger record of the first search. All other fields are passed in
238 // with empty or invalid values.
239 AutocompleteResult empty_result;
240 OmniboxLog dummy(base::string16(), false, AutocompleteInput::INVALID,
241 true, 0, false, -1,
242 AutocompleteInput::INVALID_SPEC,
243 base::TimeDelta::FromSeconds(0), 0,
244 base::TimeDelta::FromSeconds(0),
245 AutocompleteResult());
246
233 tracker_.Observe(chrome::NOTIFICATION_OMNIBOX_OPENED_URL, 247 tracker_.Observe(chrome::NOTIFICATION_OMNIBOX_OPENED_URL,
234 content::NotificationService::AllSources(), 248 content::NotificationService::AllSources(),
235 content::Details<OmniboxLog>(NULL)); 249 content::Details<OmniboxLog>(&dummy));
236 } 250 }
237 251
238 void RlzLibTest::SimulateHomepageUsage() { 252 void RlzLibTest::SimulateHomepageUsage() {
239 scoped_ptr<NavigationEntry> entry(NavigationEntry::Create()); 253 scoped_ptr<NavigationEntry> entry(NavigationEntry::Create());
240 entry->SetPageID(0); 254 entry->SetPageID(0);
241 entry->SetTransitionType(content::PAGE_TRANSITION_HOME_PAGE); 255 entry->SetTransitionType(content::PAGE_TRANSITION_HOME_PAGE);
242 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, 256 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING,
243 content::NotificationService::AllSources(), 257 content::NotificationService::AllSources(),
244 content::Details<NavigationEntry>(entry.get())); 258 content::Details<NavigationEntry>(entry.get()));
245 } 259 }
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 RLZTracker::RecordProductEvent(rlz_lib::CHROME, RLZTracker::ChromeOmnibox(), 887 RLZTracker::RecordProductEvent(rlz_lib::CHROME, RLZTracker::ChromeOmnibox(),
874 rlz_lib::FIRST_SEARCH); 888 rlz_lib::FIRST_SEARCH);
875 889
876 ExpectEventRecorded(kOmniboxFirstSearch, true); 890 ExpectEventRecorded(kOmniboxFirstSearch, true);
877 891
878 RLZTracker::ClearRlzState(); 892 RLZTracker::ClearRlzState();
879 893
880 ExpectEventRecorded(kOmniboxFirstSearch, false); 894 ExpectEventRecorded(kOmniboxFirstSearch, false);
881 } 895 }
882 #endif // defined(OS_CHROMEOS) 896 #endif // defined(OS_CHROMEOS)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698