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

Unified Diff: chrome/browser/extensions/extension_shelf_model_browsertest.cc

Issue 3129003: remove toolstrips (Closed)
Patch Set: merge Created 10 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_shelf_model_browsertest.cc
diff --git a/chrome/browser/extensions/extension_shelf_model_browsertest.cc b/chrome/browser/extensions/extension_shelf_model_browsertest.cc
deleted file mode 100644
index abb2a935c778e51b42128781d41854949105c4c4..0000000000000000000000000000000000000000
--- a/chrome/browser/extensions/extension_shelf_model_browsertest.cc
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/browser.h"
-#include "chrome/browser/extensions/extension_browsertest.h"
-#include "chrome/browser/extensions/extension_error_reporter.h"
-#include "chrome/browser/extensions/extension_host.h"
-#include "chrome/browser/extensions/extension_shelf_model.h"
-#include "chrome/browser/extensions/extensions_service.h"
-#include "chrome/browser/profile.h"
-#include "chrome/browser/views/extensions/extension_shelf.h"
-#include "chrome/browser/views/frame/browser_view.h"
-#include "chrome/common/chrome_paths.h"
-#include "chrome/common/chrome_switches.h"
-#include "chrome/test/in_process_browser_test.h"
-
-namespace {
-
-// The extension we're using as our test case.
-const char* kExtensionId = "behllobkkfkfnphdnhnkndlbkcpglgmj";
-
-}; // namespace
-
-
-// An InProcessBrowserTest for testing the ExtensionShelfModel.
-// TODO(erikkay) It's unfortunate that this needs to be an in-proc browser test.
-// It would be nice to refactor things so that ExtensionShelfModel,
-// ExtensionHost and ExtensionsService could run without so much of the browser
-// in place.
-class ExtensionShelfModelTest : public ExtensionBrowserTest,
- public ExtensionShelfModelObserver {
- public:
- virtual void SetUp() {
- inserted_count_ = 0;
- removed_count_ = 0;
- moved_count_ = 0;
- InProcessBrowserTest::SetUp();
- }
-
- virtual Browser* CreateBrowser(Profile* profile) {
- Browser* b = InProcessBrowserTest::CreateBrowser(profile);
- BrowserView* browser_view = static_cast<BrowserView*>(b->window());
- model_ = browser_view->extension_shelf()->model();
- model_->AddObserver(this);
- return b;
- }
-
- virtual void CleanUpOnMainThread() {
- model_->RemoveObserver(this);
- }
-
- virtual void ToolstripInsertedAt(ExtensionHost* toolstrip, int index) {
- inserted_count_++;
- }
-
- virtual void ToolstripRemovingAt(ExtensionHost* toolstrip, int index) {
- removed_count_++;
- }
-
- virtual void ToolstripMoved(ExtensionHost* toolstrip,
- int from_index,
- int to_index) {
- moved_count_++;
- }
-
- protected:
- ExtensionShelfModel* model_;
-
- int inserted_count_;
- int removed_count_;
- int moved_count_;
-};
-
-IN_PROC_BROWSER_TEST_F(ExtensionShelfModelTest, Basic) {
- ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("good")
- .AppendASCII("Extensions")
- .AppendASCII(kExtensionId)
- .AppendASCII("1.0.0.0")));
-
- // extension1 has two toolstrips
- EXPECT_EQ(inserted_count_, 2);
- ExtensionHost* one = model_->ToolstripAt(0).host;
- ExtensionHost* two = model_->ToolstripAt(1).host;
- EXPECT_EQ(one->GetURL().path(), "/toolstrip1.html");
- EXPECT_EQ(two->GetURL().path(), "/toolstrip2.html");
-
- model_->MoveToolstripAt(0, 1);
- EXPECT_EQ(two, model_->ToolstripAt(0).host);
- EXPECT_EQ(one, model_->ToolstripAt(1).host);
- EXPECT_EQ(moved_count_, 1);
-
- model_->RemoveToolstripAt(0);
- EXPECT_EQ(one, model_->ToolstripAt(0).host);
- EXPECT_EQ(1, model_->count());
- EXPECT_EQ(removed_count_, 1);
-}
« no previous file with comments | « chrome/browser/extensions/extension_shelf_model.cc ('k') | chrome/browser/extensions/extension_toolstrip_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698