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

Side by Side Diff: chrome/browser/extensions/api/idle/idle_api_unittest.cc

Issue 411733002: WIP: diff which plumbs through the event URL. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | « no previous file | chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager_unittest.cc » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/api/idle/idle_api.h" 5 #include "chrome/browser/extensions/api/idle/idle_api.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <string> 8 #include <string>
9 9
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 private: 101 private:
102 IdleManager* idle_manager_; 102 IdleManager* idle_manager_;
103 const std::string extension_id_; 103 const std::string extension_id_;
104 }; 104 };
105 105
106 ScopedListen::ScopedListen(IdleManager* idle_manager, 106 ScopedListen::ScopedListen(IdleManager* idle_manager,
107 const std::string& extension_id) 107 const std::string& extension_id)
108 : idle_manager_(idle_manager), 108 : idle_manager_(idle_manager),
109 extension_id_(extension_id) { 109 extension_id_(extension_id) {
110 const EventListenerInfo details(idle::OnStateChanged::kEventName, 110 const EventListenerInfo details(
111 extension_id_, 111 idle::OnStateChanged::kEventName, extension_id_, GURL(), NULL);
112 NULL);
113 idle_manager_->OnListenerAdded(details); 112 idle_manager_->OnListenerAdded(details);
114 } 113 }
115 114
116 ScopedListen::~ScopedListen() { 115 ScopedListen::~ScopedListen() {
117 const EventListenerInfo details(idle::OnStateChanged::kEventName, 116 const EventListenerInfo details(
118 extension_id_, 117 idle::OnStateChanged::kEventName, extension_id_, GURL(), NULL);
119 NULL);
120 idle_manager_->OnListenerRemoved(details); 118 idle_manager_->OnListenerRemoved(details);
121 } 119 }
122 120
123 KeyedService* IdleManagerTestFactory(content::BrowserContext* profile) { 121 KeyedService* IdleManagerTestFactory(content::BrowserContext* profile) {
124 return new IdleManager(static_cast<Profile*>(profile)); 122 return new IdleManager(static_cast<Profile*>(profile));
125 } 123 }
126 124
127 } // namespace 125 } // namespace
128 126
129 class IdleTest : public ExtensionApiUnittest { 127 class IdleTest : public ExtensionApiUnittest {
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 560
563 { 561 {
564 // Nothing should have fired, the listener wasn't added until afterward. 562 // Nothing should have fired, the listener wasn't added until afterward.
565 ScopedListen listen(idle_manager_, "test"); 563 ScopedListen listen(idle_manager_, "test");
566 idle_manager_->UpdateIdleState(); 564 idle_manager_->UpdateIdleState();
567 testing::Mock::VerifyAndClearExpectations(event_delegate_); 565 testing::Mock::VerifyAndClearExpectations(event_delegate_);
568 } 566 }
569 } 567 }
570 568
571 } // namespace extensions 569 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698