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

Side by Side Diff: chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc

Issue 2017113002: [Extensions] DCHECK that ExtensionFunctions respond (and only once) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/chromeos/file_manager/file_manager_browsertest_base.h" 5 #include "chrome/browser/chromeos/file_manager/file_manager_browsertest_base.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <deque> 9 #include <deque>
10 10
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 } 222 }
223 223
224 void Observe(int type, 224 void Observe(int type,
225 const content::NotificationSource& source, 225 const content::NotificationSource& source,
226 const content::NotificationDetails& details) override { 226 const content::NotificationDetails& details) override {
227 Message entry; 227 Message entry;
228 entry.type = type; 228 entry.type = type;
229 entry.message = type != extensions::NOTIFICATION_EXTENSION_TEST_PASSED 229 entry.message = type != extensions::NOTIFICATION_EXTENSION_TEST_PASSED
230 ? *content::Details<std::string>(details).ptr() 230 ? *content::Details<std::string>(details).ptr()
231 : std::string(); 231 : std::string();
232 entry.function = 232 if (type == extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE) {
233 type == extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE 233 entry.function =
234 ? content::Source<extensions::TestSendMessageFunction>(source).ptr() 234 content::Source<extensions::TestSendMessageFunction>(source).ptr();
235 : NULL; 235 *content::Details<std::pair<std::string, bool*>>(details).ptr()->second =
236 true;
237 }
236 messages_.push_back(entry); 238 messages_.push_back(entry);
237 base::MessageLoopForUI::current()->QuitWhenIdle(); 239 base::MessageLoopForUI::current()->QuitWhenIdle();
238 } 240 }
239 241
240 private: 242 private:
241 std::deque<Message> messages_; 243 std::deque<Message> messages_;
242 content::NotificationRegistrar registrar_; 244 content::NotificationRegistrar registrar_;
243 }; 245 };
244 246
245 } // anonymous namespace 247 } // anonymous namespace
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 } 579 }
578 580
579 // Parse the message value as JSON. 581 // Parse the message value as JSON.
580 const std::unique_ptr<const base::Value> value = 582 const std::unique_ptr<const base::Value> value =
581 base::JSONReader::Read(entry.message); 583 base::JSONReader::Read(entry.message);
582 584
583 // If the message is not the expected format, just ignore it. 585 // If the message is not the expected format, just ignore it.
584 const base::DictionaryValue* message_dictionary = NULL; 586 const base::DictionaryValue* message_dictionary = NULL;
585 std::string name; 587 std::string name;
586 if (!value || !value->GetAsDictionary(&message_dictionary) || 588 if (!value || !value->GetAsDictionary(&message_dictionary) ||
587 !message_dictionary->GetString("name", &name)) 589 !message_dictionary->GetString("name", &name)) {
590 entry.function->Reply(std::string());
588 continue; 591 continue;
592 }
589 593
590 std::string output; 594 std::string output;
591 OnMessage(name, *message_dictionary, &output); 595 OnMessage(name, *message_dictionary, &output);
592 if (HasFatalFailure()) 596 if (HasFatalFailure())
593 break; 597 break;
594 598
595 entry.function->Reply(output); 599 entry.function->Reply(output);
596 } 600 }
597 } 601 }
598 602
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 } 730 }
727 731
728 drive::DriveIntegrationService* 732 drive::DriveIntegrationService*
729 FileManagerBrowserTestBase::CreateDriveIntegrationService(Profile* profile) { 733 FileManagerBrowserTestBase::CreateDriveIntegrationService(Profile* profile) {
730 drive_volumes_[profile->GetOriginalProfile()].reset(new DriveTestVolume()); 734 drive_volumes_[profile->GetOriginalProfile()].reset(new DriveTestVolume());
731 return drive_volumes_[profile->GetOriginalProfile()] 735 return drive_volumes_[profile->GetOriginalProfile()]
732 ->CreateDriveIntegrationService(profile); 736 ->CreateDriveIntegrationService(profile);
733 } 737 }
734 738
735 } // namespace file_manager 739 } // namespace file_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698