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

Side by Side Diff: chrome/browser/bookmarks/bookmark_model_unittest.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model.cc ('k') | chrome/browser/bookmarks/bookmark_storage.h » ('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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 7
8 #include "base/base_paths.h" 8 #include "base/base_paths.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/hash_tables.h" 11 #include "base/hash_tables.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/string16.h" 13 #include "base/string16.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "base/string_split.h" 15 #include "base/string_split.h"
16 #include "base/string_util.h" 16 #include "base/string_util.h"
17 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
18 #include "chrome/browser/bookmarks/bookmark_codec.h" 18 #include "chrome/browser/bookmarks/bookmark_codec.h"
19 #include "chrome/browser/bookmarks/bookmark_model.h" 19 #include "chrome/browser/bookmarks/bookmark_model.h"
20 #include "chrome/browser/bookmarks/bookmark_model_observer.h" 20 #include "chrome/browser/bookmarks/bookmark_model_observer.h"
21 #include "chrome/browser/bookmarks/bookmark_utils.h" 21 #include "chrome/browser/bookmarks/bookmark_utils.h"
22 #include "chrome/browser/history/history_notifications.h" 22 #include "chrome/browser/history/history_notifications.h"
23 #include "chrome/common/chrome_constants.h" 23 #include "chrome/common/chrome_constants.h"
24 #include "chrome/common/chrome_notification_types.h"
24 #include "chrome/common/chrome_paths.h" 25 #include "chrome/common/chrome_paths.h"
25 #include "chrome/common/chrome_switches.h" 26 #include "chrome/common/chrome_switches.h"
26 #include "chrome/test/model_test_utils.h" 27 #include "chrome/test/model_test_utils.h"
27 #include "chrome/test/testing_browser_process_test.h" 28 #include "chrome/test/testing_browser_process_test.h"
28 #include "chrome/test/testing_profile.h" 29 #include "chrome/test/testing_profile.h"
29 #include "content/browser/browser_thread.h" 30 #include "content/browser/browser_thread.h"
30 #include "content/common/notification_details.h" 31 #include "content/common/notification_details.h"
31 #include "content/common/notification_registrar.h" 32 #include "content/common/notification_registrar.h"
32 #include "content/common/notification_source.h" 33 #include "content/common/notification_source.h"
33 #include "testing/gtest/include/gtest/gtest.h" 34 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 EXPECT_TRUE(model_.HasBookmarks()); 542 EXPECT_TRUE(model_.HasBookmarks());
542 } 543 }
543 544
544 namespace { 545 namespace {
545 546
546 // NotificationObserver implementation used in verifying we've received the 547 // NotificationObserver implementation used in verifying we've received the
547 // NOTIFY_URLS_STARRED method correctly. 548 // NOTIFY_URLS_STARRED method correctly.
548 class StarredListener : public NotificationObserver { 549 class StarredListener : public NotificationObserver {
549 public: 550 public:
550 StarredListener() : notification_count_(0), details_(false) { 551 StarredListener() : notification_count_(0), details_(false) {
551 registrar_.Add(this, NotificationType::URLS_STARRED, Source<Profile>(NULL)); 552 registrar_.Add(this, chrome::NOTIFICATION_URLS_STARRED,
553 Source<Profile>(NULL));
552 } 554 }
553 555
554 virtual void Observe(NotificationType type, 556 virtual void Observe(int type,
555 const NotificationSource& source, 557 const NotificationSource& source,
556 const NotificationDetails& details) { 558 const NotificationDetails& details) {
557 if (type == NotificationType::URLS_STARRED) { 559 if (type == chrome::NOTIFICATION_URLS_STARRED) {
558 notification_count_++; 560 notification_count_++;
559 details_ = *(Details<history::URLsStarredDetails>(details).ptr()); 561 details_ = *(Details<history::URLsStarredDetails>(details).ptr());
560 } 562 }
561 } 563 }
562 564
563 // Number of times NOTIFY_URLS_STARRED has been observed. 565 // Number of times NOTIFY_URLS_STARRED has been observed.
564 int notification_count_; 566 int notification_count_;
565 567
566 // Details from the last NOTIFY_URLS_STARRED. 568 // Details from the last NOTIFY_URLS_STARRED.
567 history::URLsStarredDetails details_; 569 history::URLsStarredDetails details_;
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 } 1081 }
1080 1082
1081 TEST_F(BookmarkModelTest, SyncNodeVisibileWithChildren) { 1083 TEST_F(BookmarkModelTest, SyncNodeVisibileWithChildren) {
1082 const BookmarkNode* root = model_.synced_node(); 1084 const BookmarkNode* root = model_.synced_node();
1083 const string16 title(ASCIIToUTF16("foo")); 1085 const string16 title(ASCIIToUTF16("foo"));
1084 const GURL url("http://foo.com"); 1086 const GURL url("http://foo.com");
1085 1087
1086 model_.AddURL(root, 0, title, url); 1088 model_.AddURL(root, 0, title, url);
1087 EXPECT_TRUE(model_.synced_node()->IsVisible()); 1089 EXPECT_TRUE(model_.synced_node()->IsVisible());
1088 } 1090 }
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model.cc ('k') | chrome/browser/bookmarks/bookmark_storage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698