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

Unified Diff: chrome/browser/rlz/chrome_rlz_tracker_delegate_unittest.cc

Issue 1212163011: Componentize chrome/browser/rlz (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/rlz/chrome_rlz_tracker_delegate.cc ('k') | chrome/browser/rlz/rlz.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/rlz/chrome_rlz_tracker_delegate_unittest.cc
diff --git a/chrome/browser/rlz/chrome_rlz_tracker_delegate_unittest.cc b/chrome/browser/rlz/chrome_rlz_tracker_delegate_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..fd7d6e00a24e0a619a3aeb8ab7497b5391410411
--- /dev/null
+++ b/chrome/browser/rlz/chrome_rlz_tracker_delegate_unittest.cc
@@ -0,0 +1,48 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/rlz/chrome_rlz_tracker_delegate.h"
+
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/chrome_notification_types.h"
+#include "content/public/browser/navigation_details.h"
+#include "content/public/browser/navigation_entry.h"
+#include "content/public/browser/notification_service.h"
+#include "content/public/browser/notification_source.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+using content::NavigationEntry;
+using content::LoadCommittedDetails;
+
+class ChromeRLZTrackerDelegateTest : public testing::Test {
+ public:
+ ChromeRLZTrackerDelegateTest() : delegate_(new ChromeRLZTrackerDelegate) {}
+ ~ChromeRLZTrackerDelegateTest() override {}
+
+ void SendNotification(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
+ content::NotificationObserver* observer = delegate_.get();
+ observer->Observe(type, source, details);
+ }
+
+ private:
+ scoped_ptr<ChromeRLZTrackerDelegate> delegate_;
+};
+
+TEST_F(ChromeRLZTrackerDelegateTest, ObserveHandlesBadArgs) {
+ scoped_ptr<content::LoadCommittedDetails> details(
+ new content::LoadCommittedDetails());
+ scoped_ptr<content::NavigationEntry> entry(
+ content::NavigationEntry::Create());
+ details->entry = entry.get();
+ details->entry->SetPageID(0);
+ details->entry->SetTransitionType(ui::PAGE_TRANSITION_LINK);
+ SendNotification(content::NOTIFICATION_NAV_ENTRY_COMMITTED,
+ content::NotificationService::AllSources(),
+ content::Details<NavigationEntry>(nullptr));
+ SendNotification(content::NOTIFICATION_NAV_ENTRY_COMMITTED,
+ content::NotificationService::AllSources(),
+ content::Details<LoadCommittedDetails>(details.get()));
+}
« no previous file with comments | « chrome/browser/rlz/chrome_rlz_tracker_delegate.cc ('k') | chrome/browser/rlz/rlz.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698