OLD | NEW |
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_utils.h" | 20 #include "chrome/browser/bookmarks/bookmark_utils.h" |
21 #include "chrome/browser/history/history_notifications.h" | 21 #include "chrome/browser/history/history_notifications.h" |
22 #include "chrome/common/chrome_constants.h" | 22 #include "chrome/common/chrome_constants.h" |
| 23 #include "chrome/common/chrome_notification_types.h" |
23 #include "chrome/common/chrome_paths.h" | 24 #include "chrome/common/chrome_paths.h" |
24 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
25 #include "chrome/test/model_test_utils.h" | 26 #include "chrome/test/model_test_utils.h" |
26 #include "chrome/test/testing_browser_process_test.h" | 27 #include "chrome/test/testing_browser_process_test.h" |
27 #include "chrome/test/testing_profile.h" | 28 #include "chrome/test/testing_profile.h" |
28 #include "content/browser/browser_thread.h" | 29 #include "content/browser/browser_thread.h" |
29 #include "content/common/notification_details.h" | 30 #include "content/common/notification_details.h" |
30 #include "content/common/notification_registrar.h" | 31 #include "content/common/notification_registrar.h" |
31 #include "content/common/notification_source.h" | 32 #include "content/common/notification_source.h" |
32 #include "testing/gtest/include/gtest/gtest.h" | 33 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 EXPECT_TRUE(model_.HasBookmarks()); | 541 EXPECT_TRUE(model_.HasBookmarks()); |
541 } | 542 } |
542 | 543 |
543 namespace { | 544 namespace { |
544 | 545 |
545 // NotificationObserver implementation used in verifying we've received the | 546 // NotificationObserver implementation used in verifying we've received the |
546 // NOTIFY_URLS_STARRED method correctly. | 547 // NOTIFY_URLS_STARRED method correctly. |
547 class StarredListener : public NotificationObserver { | 548 class StarredListener : public NotificationObserver { |
548 public: | 549 public: |
549 StarredListener() : notification_count_(0), details_(false) { | 550 StarredListener() : notification_count_(0), details_(false) { |
550 registrar_.Add(this, NotificationType::URLS_STARRED, Source<Profile>(NULL)); | 551 registrar_.Add(this, chrome::NOTIFICATION_URLS_STARRED, |
| 552 Source<Profile>(NULL)); |
551 } | 553 } |
552 | 554 |
553 virtual void Observe(NotificationType type, | 555 virtual void Observe(int type, |
554 const NotificationSource& source, | 556 const NotificationSource& source, |
555 const NotificationDetails& details) { | 557 const NotificationDetails& details) { |
556 if (type == NotificationType::URLS_STARRED) { | 558 if (type == chrome::NOTIFICATION_URLS_STARRED) { |
557 notification_count_++; | 559 notification_count_++; |
558 details_ = *(Details<history::URLsStarredDetails>(details).ptr()); | 560 details_ = *(Details<history::URLsStarredDetails>(details).ptr()); |
559 } | 561 } |
560 } | 562 } |
561 | 563 |
562 // Number of times NOTIFY_URLS_STARRED has been observed. | 564 // Number of times NOTIFY_URLS_STARRED has been observed. |
563 int notification_count_; | 565 int notification_count_; |
564 | 566 |
565 // Details from the last NOTIFY_URLS_STARRED. | 567 // Details from the last NOTIFY_URLS_STARRED. |
566 history::URLsStarredDetails details_; | 568 history::URLsStarredDetails details_; |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 } | 1080 } |
1079 | 1081 |
1080 TEST_F(BookmarkModelTest, SyncNodeVisibileWithChildren) { | 1082 TEST_F(BookmarkModelTest, SyncNodeVisibileWithChildren) { |
1081 const BookmarkNode* root = model_.synced_node(); | 1083 const BookmarkNode* root = model_.synced_node(); |
1082 const string16 title(ASCIIToUTF16("foo")); | 1084 const string16 title(ASCIIToUTF16("foo")); |
1083 const GURL url("http://foo.com"); | 1085 const GURL url("http://foo.com"); |
1084 | 1086 |
1085 model_.AddURL(root, 0, title, url); | 1087 model_.AddURL(root, 0, title, url); |
1086 EXPECT_TRUE(model_.synced_node()->IsVisible()); | 1088 EXPECT_TRUE(model_.synced_node()->IsVisible()); |
1087 } | 1089 } |
OLD | NEW |