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

Side by Side Diff: chrome/browser/apps/ephemeral_app_browsertest.cc

Issue 996213005: Don't crash when trying to create an ExtensionSyncData from invalid SyncData. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 5 years, 9 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 "chrome/browser/apps/ephemeral_app_browsertest.h" 5 #include "chrome/browser/apps/ephemeral_app_browsertest.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "apps/app_restore_service.h" 9 #include "apps/app_restore_service.h"
10 #include "apps/saved_files_service.h" 10 #include "apps/saved_files_service.h"
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 &mock_sync_processor_)), 526 &mock_sync_processor_)),
527 scoped_ptr<syncer::SyncErrorFactory>( 527 scoped_ptr<syncer::SyncErrorFactory>(
528 new syncer::SyncErrorFactoryMock())); 528 new syncer::SyncErrorFactoryMock()));
529 } 529 }
530 530
531 scoped_ptr<AppSyncData> GetLastSyncChangeForApp(const std::string& id) { 531 scoped_ptr<AppSyncData> GetLastSyncChangeForApp(const std::string& id) {
532 scoped_ptr<AppSyncData> sync_data; 532 scoped_ptr<AppSyncData> sync_data;
533 for (syncer::SyncChangeList::iterator it = 533 for (syncer::SyncChangeList::iterator it =
534 mock_sync_processor_.changes().begin(); 534 mock_sync_processor_.changes().begin();
535 it != mock_sync_processor_.changes().end(); ++it) { 535 it != mock_sync_processor_.changes().end(); ++it) {
536 scoped_ptr<AppSyncData> data(new AppSyncData(*it)); 536 scoped_ptr<AppSyncData> data(AppSyncData::CreateFromSyncChange(*it));
537 if (data->id() == id) 537 if (data->id() == id)
not at google - send to devlin 2015/03/11 23:21:34 It could be null, though?
Yoyo Zhou 2015/03/12 00:25:48 Done.
538 sync_data.reset(data.release()); 538 sync_data.reset(data.release());
539 } 539 }
540 540
541 return sync_data.Pass(); 541 return sync_data.Pass();
542 } 542 }
543 543
544 void VerifySyncChange(const AppSyncData* sync_change, bool expect_enabled) { 544 void VerifySyncChange(const AppSyncData* sync_change, bool expect_enabled) {
545 if (!kEnableSync) 545 if (!kEnableSync)
546 return; 546 return;
547 547
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 base::Bind(&PowerSaveBlockerStub::Create, &power_settings)); 1032 base::Bind(&PowerSaveBlockerStub::Create, &power_settings));
1033 1033
1034 const Extension* app = InstallAndLaunchEphemeralApp(kPowerTestApp); 1034 const Extension* app = InstallAndLaunchEphemeralApp(kPowerTestApp);
1035 ASSERT_TRUE(app); 1035 ASSERT_TRUE(app);
1036 EXPECT_EQ(1, power_settings.keep_awake_count()); 1036 EXPECT_EQ(1, power_settings.keep_awake_count());
1037 1037
1038 CloseAppWaitForUnload(app->id()); 1038 CloseAppWaitForUnload(app->id());
1039 1039
1040 EXPECT_EQ(0, power_settings.keep_awake_count()); 1040 EXPECT_EQ(0, power_settings.keep_awake_count());
1041 } 1041 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/app_sync_bundle.cc » ('j') | chrome/browser/extensions/app_sync_bundle.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698