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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 "base/message_loop.h"
6 #include "base/string_util.h"
7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/search_engines/template_url.h"
9 #include "chrome/browser/search_engines/template_url_service.h"
10 #include "chrome/browser/search_engines/template_url_service_factory.h"
11 #include "chrome/browser/ui/views/first_run_bubble.h"
12 #include "chrome/test/base/testing_profile.h"
13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "views/view.h"
15 #include "views/widget/widget.h"
16
17 #if defined(USE_AURA)
18 #include "ui/aura/desktop.h"
19 #endif
20
21 class FirstRunBubbleTest : public testing::Test {
22 public:
23 void SetUp() {
24 profile_.CreateTemplateURLService();
25 MessageLoopForUI::current()->RunAllPending();
26 TemplateURLService* turl_model =
27 TemplateURLServiceFactory::GetForProfile(&profile_);
28 turl_model->Load();
29 // Reset the default TemplateURL.
30 default_t_url_ = new TemplateURL();
31 turl_model->Add(default_t_url_);
32 turl_model->SetDefaultSearchProvider(default_t_url_);
33 }
34
35 MessageLoopForUI message_loop_;
36 TestingProfile profile_;
37 TemplateURL* default_t_url_;
38
39 void RunPendingMessages() {
40 #if defined(USE_AURA)
41 message_loop_.RunAllPendingWithDispatcher(
42 aura::Desktop::GetInstance()->GetDispatcher());
43 #else
44 message_loop_.RunAllPending();
45 #endif
46 }
47
48 void TearDown() {
49 RunPendingMessages();
50 }
51 };
52
53 TEST_F(FirstRunBubbleTest, CreateAndClose) {
54 gfx::Rect anchor(10, 20, 0, 0);
55 FirstRunBubble* delegate =
56 FirstRunBubble::Show(&profile_,
57 NULL,
58 anchor,
59 views::BubbleBorder::TOP_LEFT);
60 EXPECT_TRUE(delegate != NULL);
61 delegate->GetWidget()->CloseNow();
62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698