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

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

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/rlz/rlz.cc ('k') | chrome/browser/safe_browsing/client_side_detection_host.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/test/test_reg_util_win.h" 10 #include "base/test/test_reg_util_win.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "base/win/registry.h" 12 #include "base/win/registry.h"
13 #include "chrome/browser/autocomplete/autocomplete.h" 13 #include "chrome/browser/autocomplete/autocomplete.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/common/chrome_notification_types.h" 15 #include "chrome/common/chrome_notification_types.h"
16 #include "chrome/common/env_vars.h" 16 #include "chrome/common/env_vars.h"
17 #include "chrome/installer/util/browser_distribution.h" 17 #include "chrome/installer/util/browser_distribution.h"
18 #include "chrome/installer/util/google_update_constants.h" 18 #include "chrome/installer/util/google_update_constants.h"
19 #include "content/browser/tab_contents/navigation_entry.h" 19 #include "content/browser/tab_contents/navigation_entry.h"
20 #include "content/common/notification_service.h" 20 #include "content/public/browser/notification_service.h"
21 #include "content/public/browser/notification_details.h" 21 #include "content/public/browser/notification_details.h"
22 #include "content/public/browser/notification_source.h" 22 #include "content/public/browser/notification_source.h"
23 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
24 24
25 using base::win::RegKey; 25 using base::win::RegKey;
26 using registry_util::RegistryOverrideManager; 26 using registry_util::RegistryOverrideManager;
27 using testing::AssertionResult; 27 using testing::AssertionResult;
28 using testing::AssertionSuccess; 28 using testing::AssertionSuccess;
29 using testing::AssertionFailure; 29 using testing::AssertionFailure;
30 30
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 ASSERT_EQ(ERROR_SUCCESS, key.WriteValue(google_update::kRegRLZBrandField, 193 ASSERT_EQ(ERROR_SUCCESS, key.WriteValue(google_update::kRegRLZBrandField,
194 L"TEST")); 194 L"TEST"));
195 } 195 }
196 196
197 void RlzLibTest::TearDown() { 197 void RlzLibTest::TearDown() {
198 testing::Test::TearDown(); 198 testing::Test::TearDown();
199 } 199 }
200 200
201 void RlzLibTest::SimulateOmniboxUsage() { 201 void RlzLibTest::SimulateOmniboxUsage() {
202 tracker_.Observe(chrome::NOTIFICATION_OMNIBOX_OPENED_URL, 202 tracker_.Observe(chrome::NOTIFICATION_OMNIBOX_OPENED_URL,
203 NotificationService::AllSources(), 203 content::NotificationService::AllSources(),
204 content::Details<AutocompleteLog>(NULL)); 204 content::Details<AutocompleteLog>(NULL));
205 } 205 }
206 206
207 void RlzLibTest::SimulateHomepageUsage() { 207 void RlzLibTest::SimulateHomepageUsage() {
208 NavigationEntry entry(NULL, 0, GURL(), GURL(), string16(), 208 NavigationEntry entry(NULL, 0, GURL(), GURL(), string16(),
209 content::PAGE_TRANSITION_HOME_PAGE, false); 209 content::PAGE_TRANSITION_HOME_PAGE, false);
210 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, 210 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING,
211 NotificationService::AllSources(), 211 content::NotificationService::AllSources(),
212 content::Details<NavigationEntry>(&entry)); 212 content::Details<NavigationEntry>(&entry));
213 } 213 }
214 214
215 void RlzLibTest::InvokeDelayedInit() { 215 void RlzLibTest::InvokeDelayedInit() {
216 tracker_.DelayedInit(); 216 tracker_.DelayedInit();
217 } 217 }
218 218
219 void RlzLibTest::ExpectEventRecorded(const char* event_name, bool expected) { 219 void RlzLibTest::ExpectEventRecorded(const char* event_name, bool expected) {
220 char cgi[rlz_lib::kMaxCgiLength]; 220 char cgi[rlz_lib::kMaxCgiLength];
221 GetProductEventsAsCgi(rlz_lib::CHROME, cgi, arraysize(cgi)); 221 GetProductEventsAsCgi(rlz_lib::CHROME, cgi, arraysize(cgi));
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 EXPECT_TRUE(RLZTracker::GetAccessPointRlz(rlz_lib::CHROME_OMNIBOX, &rlz)); 536 EXPECT_TRUE(RLZTracker::GetAccessPointRlz(rlz_lib::CHROME_OMNIBOX, &rlz));
537 EXPECT_STREQ(kNewOmniboxRlzString, WideToUTF8(rlz).c_str()); 537 EXPECT_STREQ(kNewOmniboxRlzString, WideToUTF8(rlz).c_str());
538 EXPECT_TRUE(RLZTracker::GetAccessPointRlz(rlz_lib::CHROME_HOME_PAGE, &rlz)); 538 EXPECT_TRUE(RLZTracker::GetAccessPointRlz(rlz_lib::CHROME_HOME_PAGE, &rlz));
539 EXPECT_STREQ(kNewHomepageRlzString, WideToUTF8(rlz).c_str()); 539 EXPECT_STREQ(kNewHomepageRlzString, WideToUTF8(rlz).c_str());
540 } 540 }
541 541
542 TEST_F(RlzLibTest, ObserveHandlesBadArgs) { 542 TEST_F(RlzLibTest, ObserveHandlesBadArgs) {
543 NavigationEntry entry(NULL, 0, GURL(), GURL(), string16(), 543 NavigationEntry entry(NULL, 0, GURL(), GURL(), string16(),
544 content::PAGE_TRANSITION_LINK, false); 544 content::PAGE_TRANSITION_LINK, false);
545 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, 545 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING,
546 NotificationService::AllSources(), 546 content::NotificationService::AllSources(),
547 content::Details<NavigationEntry>(NULL)); 547 content::Details<NavigationEntry>(NULL));
548 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING, 548 tracker_.Observe(content::NOTIFICATION_NAV_ENTRY_PENDING,
549 NotificationService::AllSources(), 549 content::NotificationService::AllSources(),
550 content::Details<NavigationEntry>(&entry)); 550 content::Details<NavigationEntry>(&entry));
551 } 551 }
OLDNEW
« no previous file with comments | « chrome/browser/rlz/rlz.cc ('k') | chrome/browser/safe_browsing/client_side_detection_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698