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

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"
msw 2011/11/03 20:25:38 I don't think string_util.h is needed.
alicet1 2011/11/04 22:37:36 Done.
7 #include "base/utf_string_conversions.h"
msw 2011/11/03 20:25:38 I don't think utf_string_conversions.h is needed.
alicet1 2011/11/04 22:37:36 Done.
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"
msw 2011/11/03 20:25:38 I don't think view.h is needed.
alicet1 2011/11/04 22:37:36 Done.
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() {
msw 2011/11/03 20:25:38 SetUp and TearDown are protected virtual method ov
alicet1 2011/11/04 22:37:36 Done.
24 profile_.CreateTemplateURLService();
25 MessageLoopForUI::current()->RunAllPending();
26 TemplateURLService* turl_model =
msw 2011/11/03 20:25:38 Wow is all this really needed for a TestingProfile
Miranda Callahan 2011/11/03 20:59:39 I don't think you have to do all this -- would it
alicet1 2011/11/04 22:37:36 I tried that route first, and I think it worked ou
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_;
msw 2011/11/03 20:25:38 These data members should be made private.
alicet1 2011/11/04 22:37:36 Done.
36 TestingProfile profile_;
37 TemplateURL* default_t_url_;
38
39 void RunPendingMessages() {
msw 2011/11/03 20:25:38 It seems like this function's body could be put di
alicet1 2011/11/04 22:37:36 Done.
40 #if defined(USE_AURA)
msw 2011/11/03 20:25:38 Hopefully Ben or someone more familiar with aura t
alicet1 2011/11/04 22:37:36 yeah, this is from views_test_base.h, on how 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