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

Unified Diff: chrome/browser/ui/views/first_run_bubble_unittest.cc

Issue 8265005: first run bubble using the views/bubble api. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: update Created 9 years, 1 month 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/ui/views/first_run_bubble_unittest.cc
diff --git a/chrome/browser/ui/views/first_run_bubble_unittest.cc b/chrome/browser/ui/views/first_run_bubble_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..600132ed22a377e7d930ffb5a938595c24aa96ad
--- /dev/null
+++ b/chrome/browser/ui/views/first_run_bubble_unittest.cc
@@ -0,0 +1,58 @@
+// Copyright (c) 2011 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/search_engines/template_url.h"
+#include "chrome/browser/search_engines/template_url_service.h"
+#include "chrome/browser/search_engines/template_url_service_factory.h"
+#include "chrome/browser/ui/views/first_run_bubble.h"
+#include "chrome/test/base/testing_profile.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "views/test/views_test_base.h"
+#include "views/view.h"
+#include "views/widget/widget.h"
+
+class FirstRunBubbleTest : public views::ViewsTestBase {
+ public:
+ FirstRunBubbleTest();
+ virtual ~FirstRunBubbleTest();
+
+ // Overrides from views::ViewsTestBase:
+ virtual void SetUp() OVERRIDE;
+
+ protected:
+ TestingProfile* profile() { return &profile_; }
+
+ private:
+ TestingProfile profile_;
+ TemplateURL* default_t_url_;
+
+ DISALLOW_COPY_AND_ASSIGN(FirstRunBubbleTest);
+};
+
+FirstRunBubbleTest::FirstRunBubbleTest() : default_t_url_(NULL) {}
+FirstRunBubbleTest::~FirstRunBubbleTest() {}
+
+void FirstRunBubbleTest::SetUp() {
+ ViewsTestBase::SetUp();
+ profile_.CreateTemplateURLService();
+ TemplateURLService* turl_model =
+ TemplateURLServiceFactory::GetForProfile(&profile_);
+ turl_model->Load();
+ // Reset the default TemplateURL.
+ default_t_url_ = new TemplateURL();
msw 2011/11/11 02:30:21 Outdent these three lines by two spaces.
alicet1 2011/11/12 00:03:51 Done.
+ turl_model->Add(default_t_url_);
+ turl_model->SetDefaultSearchProvider(default_t_url_);
+}
+
+TEST_F(FirstRunBubbleTest, CreateAndClose) {
+ gfx::Rect anchor(10, 20, 0, 0);
+ FirstRunBubble* delegate =
+ FirstRunBubble::Show(profile(),
+ NULL,
+ anchor,
+ views::BubbleBorder::TOP_LEFT,
+ FirstRun::MINIMAL_BUBBLE);
+ EXPECT_TRUE(delegate != NULL);
+ delegate->GetWidget()->CloseNow();
+}

Powered by Google App Engine
This is Rietveld 408576698