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

Side by Side Diff: components/suggestions/suggestions_service_impl_unittest.cc

Issue 2657673004: Add shutdown notification and service refs to SyncServiceObserver. (Closed)
Patch Set: Chromeos fix Created 3 years, 10 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/suggestions/suggestions_service_impl.h" 5 #include "components/suggestions/suggestions_service_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 CreateSuggestionsServiceWithMocks()); 391 CreateSuggestionsServiceWithMocks());
392 ASSERT_TRUE(suggestions_service != nullptr); 392 ASSERT_TRUE(suggestions_service != nullptr);
393 EXPECT_CALL(*mock_sync_service_, CanSyncStart()) 393 EXPECT_CALL(*mock_sync_service_, CanSyncStart())
394 .WillRepeatedly(Return(false)); 394 .WillRepeatedly(Return(false));
395 395
396 auto subscription = suggestions_service->AddCallback(base::Bind( 396 auto subscription = suggestions_service->AddCallback(base::Bind(
397 &SuggestionsServiceTest::CheckCallback, base::Unretained(this))); 397 &SuggestionsServiceTest::CheckCallback, base::Unretained(this)));
398 398
399 // Tell SuggestionsService that the sync state changed. The cache should be 399 // Tell SuggestionsService that the sync state changed. The cache should be
400 // cleared and empty data returned to the callback. 400 // cleared and empty data returned to the callback.
401 suggestions_service->OnStateChanged(); 401 suggestions_service->OnStateChanged(mock_sync_service_.get());
402 402
403 // Ensure that CheckCallback ran once with empty data. 403 // Ensure that CheckCallback ran once with empty data.
404 EXPECT_EQ(1, suggestions_data_callback_count_); 404 EXPECT_EQ(1, suggestions_data_callback_count_);
405 EXPECT_EQ(1, suggestions_empty_data_count_); 405 EXPECT_EQ(1, suggestions_empty_data_count_);
406 406
407 // Try to fetch suggestions. Since sync is not active, no network request 407 // Try to fetch suggestions. Since sync is not active, no network request
408 // should be sent. 408 // should be sent.
409 suggestions_service->FetchSuggestionsData(); 409 suggestions_service->FetchSuggestionsData();
410 410
411 // Let any network request run. 411 // Let any network request run.
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 EXPECT_CALL(*mock_thumbnail_manager_, GetImageForURL(test_url, _)); 757 EXPECT_CALL(*mock_thumbnail_manager_, GetImageForURL(test_url, _));
758 suggestions_service->GetPageThumbnail(test_url, dummy_callback); 758 suggestions_service->GetPageThumbnail(test_url, dummy_callback);
759 759
760 EXPECT_CALL(*mock_thumbnail_manager_, AddImageURL(test_url, thumbnail_url)); 760 EXPECT_CALL(*mock_thumbnail_manager_, AddImageURL(test_url, thumbnail_url));
761 EXPECT_CALL(*mock_thumbnail_manager_, GetImageForURL(test_url, _)); 761 EXPECT_CALL(*mock_thumbnail_manager_, GetImageForURL(test_url, _));
762 suggestions_service->GetPageThumbnailWithURL(test_url, thumbnail_url, 762 suggestions_service->GetPageThumbnailWithURL(test_url, thumbnail_url,
763 dummy_callback); 763 dummy_callback);
764 } 764 }
765 765
766 } // namespace suggestions 766 } // namespace suggestions
OLDNEW
« no previous file with comments | « components/suggestions/suggestions_service_impl.cc ('k') | components/sync/driver/sync_error_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698