Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/extensions/extension_action_test_util.h" | |
| 6 #include "chrome/browser/ui/toolbar/component_toolbar_actions_factory.h" | |
| 7 #include "chrome/browser/ui/toolbar/toolbar_actions_model.h" | |
| 8 #include "chrome/test/base/browser_with_test_window_test.h" | |
| 9 | |
| 10 class ComponentToolbarActionsFactoryUnitTest | |
| 11 : public BrowserWithTestWindowTest { | |
| 12 public: | |
| 13 ComponentToolbarActionsFactoryUnitTest() {} | |
| 14 ~ComponentToolbarActionsFactoryUnitTest() override {} | |
| 15 | |
| 16 void SetUp() override { | |
| 17 BrowserWithTestWindowTest::SetUp(); | |
| 18 actions_factory_ = | |
| 19 extensions::extension_action_test_util:: | |
| 20 CreateToolbarModelForProfileWithoutWaitingForReady(profile()) | |
| 21 ->component_actions_factory(); | |
| 22 } | |
| 23 | |
| 24 protected: | |
| 25 ComponentToolbarActionsFactory* actions_factory_; | |
|
msw
2017/01/10 23:23:59
nit: = nullptr
takumif
2017/02/17 03:22:51
Done.
| |
| 26 | |
| 27 private: | |
| 28 DISALLOW_COPY_AND_ASSIGN(ComponentToolbarActionsFactoryUnitTest); | |
| 29 }; | |
| 30 | |
| 31 TEST_F(ComponentToolbarActionsFactoryUnitTest, GetInitialIds) { | |
| 32 std::string id1("id1"); | |
| 33 std::string id2("id2"); | |
| 34 std::string id3("id3"); | |
| 35 | |
| 36 actions_factory_->OnAddComponentActionBeforeInit(id1); | |
| 37 actions_factory_->OnAddComponentActionBeforeInit(id2); | |
| 38 actions_factory_->OnAddComponentActionBeforeInit(id3); | |
| 39 actions_factory_->OnRemoveComponentActionBeforeInit(id2); | |
| 40 | |
| 41 std::set<std::string> initial_ids = | |
| 42 actions_factory_->GetInitialComponentIds(); | |
| 43 EXPECT_TRUE(base::ContainsKey(initial_ids, id1)); | |
| 44 EXPECT_FALSE(base::ContainsKey(initial_ids, id2)); | |
| 45 EXPECT_TRUE(base::ContainsKey(initial_ids, id3)); | |
| 46 } | |
| OLD | NEW |