| OLD | NEW |
| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 tab_contents()->profile())); | 52 tab_contents()->profile())); |
| 53 | 53 |
| 54 // Create an ExtensionService so the ScriptBadgeController can find its | 54 // Create an ExtensionService so the ScriptBadgeController can find its |
| 55 // extensions. | 55 // extensions. |
| 56 CommandLine command_line(CommandLine::NO_PROGRAM); | 56 CommandLine command_line(CommandLine::NO_PROGRAM); |
| 57 extension_service_ = extension_system->CreateExtensionService( | 57 extension_service_ = extension_system->CreateExtensionService( |
| 58 &command_line, FilePath(), false); | 58 &command_line, FilePath(), false); |
| 59 | 59 |
| 60 script_executor_.reset(new ScriptExecutor(web_contents())); | 60 script_executor_.reset(new ScriptExecutor(web_contents())); |
| 61 script_badge_controller_.reset(new ScriptBadgeController( | 61 script_badge_controller_.reset(new ScriptBadgeController( |
| 62 tab_contents(), script_executor_.get())); | 62 web_contents(), script_executor_.get())); |
| 63 } | 63 } |
| 64 | 64 |
| 65 protected: | 65 protected: |
| 66 // Creates a test extension and adds it to |extension_service_|. | 66 // Creates a test extension and adds it to |extension_service_|. |
| 67 scoped_refptr<const Extension> AddTestExtension() { | 67 scoped_refptr<const Extension> AddTestExtension() { |
| 68 scoped_refptr<const Extension> extension = ExtensionBuilder() | 68 scoped_refptr<const Extension> extension = ExtensionBuilder() |
| 69 .SetManifest(DictionaryBuilder() | 69 .SetManifest(DictionaryBuilder() |
| 70 .Set("name", "Extension with page action") | 70 .Set("name", "Extension with page action") |
| 71 .Set("version", "1.0.0") | 71 .Set("version", "1.0.0") |
| 72 .Set("manifest_version", 2) | 72 .Set("manifest_version", 2) |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 // Getting attention a second time should have no effect. | 240 // Getting attention a second time should have no effect. |
| 241 script_badge_controller_->GetAttentionFor(extension->id()); | 241 script_badge_controller_->GetAttentionFor(extension->id()); |
| 242 | 242 |
| 243 EXPECT_THAT(script_badge_controller_->GetCurrentActions(), | 243 EXPECT_THAT(script_badge_controller_->GetCurrentActions(), |
| 244 testing::ElementsAre(extension->script_badge())); | 244 testing::ElementsAre(extension->script_badge())); |
| 245 EXPECT_EQ(0, subsequent_get_attention_call.events); | 245 EXPECT_EQ(0, subsequent_get_attention_call.events); |
| 246 }; | 246 }; |
| 247 | 247 |
| 248 } // namespace | 248 } // namespace |
| 249 } // namespace extensions | 249 } // namespace extensions |
| OLD | NEW |