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

Side by Side Diff: chrome/browser/extensions/script_badge_controller_unittest.cc

Issue 10784035: Refactored SettingsFrontend and forwarding of calls to the backends. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added comment Created 8 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
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 <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 17 matching lines...) Expand all
28 #include "testing/gmock/include/gmock/gmock.h" 28 #include "testing/gmock/include/gmock/gmock.h"
29 29
30 using content::BrowserThread; 30 using content::BrowserThread;
31 31
32 namespace extensions { 32 namespace extensions {
33 namespace { 33 namespace {
34 34
35 class ScriptBadgeControllerTest : public TabContentsTestHarness { 35 class ScriptBadgeControllerTest : public TabContentsTestHarness {
36 public: 36 public:
37 ScriptBadgeControllerTest() 37 ScriptBadgeControllerTest()
38 : ui_thread_(BrowserThread::UI, MessageLoop::current()) { 38 : ui_thread_(BrowserThread::UI, MessageLoop::current()),
39 } 39 file_thread_(BrowserThread::FILE, MessageLoop::current()) {}
40 40
41 virtual void SetUp() OVERRIDE { 41 virtual void SetUp() OVERRIDE {
42 // Note that this sets a PageActionController into the 42 // Note that this sets a PageActionController into the
43 // extension_tab_helper()->location_bar_controller() field. Do 43 // extension_tab_helper()->location_bar_controller() field. Do
44 // not use that for testing. 44 // not use that for testing.
45 TabContentsTestHarness::SetUp(); 45 TabContentsTestHarness::SetUp();
46 46
47 TestExtensionSystem* extension_system = 47 TestExtensionSystem* extension_system =
48 static_cast<TestExtensionSystem*>(ExtensionSystem::Get( 48 static_cast<TestExtensionSystem*>(ExtensionSystem::Get(
49 tab_contents()->profile())); 49 tab_contents()->profile()));
(...skipping 25 matching lines...) Expand all
75 extension_service_->AddExtension(extension); 75 extension_service_->AddExtension(extension);
76 return extension; 76 return extension;
77 } 77 }
78 78
79 ExtensionService* extension_service_; 79 ExtensionService* extension_service_;
80 scoped_ptr<ScriptExecutor> script_executor_; 80 scoped_ptr<ScriptExecutor> script_executor_;
81 scoped_ptr<ScriptBadgeController> script_badge_controller_; 81 scoped_ptr<ScriptBadgeController> script_badge_controller_;
82 82
83 private: 83 private:
84 content::TestBrowserThread ui_thread_; 84 content::TestBrowserThread ui_thread_;
85 content::TestBrowserThread file_thread_;
85 }; 86 };
86 87
87 struct CountingNotificationObserver : public content::NotificationObserver { 88 struct CountingNotificationObserver : public content::NotificationObserver {
88 CountingNotificationObserver() : events(0) {} 89 CountingNotificationObserver() : events(0) {}
89 90
90 virtual void Observe(int type, 91 virtual void Observe(int type,
91 const content::NotificationSource& source, 92 const content::NotificationSource& source,
92 const content::NotificationDetails& details) OVERRIDE { 93 const content::NotificationDetails& details) OVERRIDE {
93 events++; 94 events++;
94 } 95 }
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 // Getting attention a second time should have no effect. 230 // Getting attention a second time should have no effect.
230 script_badge_controller_->GetAttentionFor(extension->id()); 231 script_badge_controller_->GetAttentionFor(extension->id());
231 232
232 EXPECT_THAT(script_badge_controller_->GetCurrentActions(), 233 EXPECT_THAT(script_badge_controller_->GetCurrentActions(),
233 testing::ElementsAre(extension->script_badge())); 234 testing::ElementsAre(extension->script_badge()));
234 EXPECT_EQ(0, subsequent_get_attention_call.events); 235 EXPECT_EQ(0, subsequent_get_attention_call.events);
235 }; 236 };
236 237
237 } // namespace 238 } // namespace
238 } // namespace extensions 239 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698