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

Side by Side Diff: chrome/browser/cocoa/bug_report_window_controller_unittest.mm

Issue 3095004: [Mac] Use the new {EXPECT,ASSERT}_NS{EQ,NE} macros where possible. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Fix compile 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/ref_counted.h" 7 #include "base/ref_counted.h"
8 #import "chrome/browser/cocoa/bug_report_window_controller.h" 8 #import "chrome/browser/cocoa/bug_report_window_controller.h"
9 #include "chrome/browser/renderer_host/site_instance.h" 9 #include "chrome/browser/renderer_host/site_instance.h"
10 #include "chrome/browser/renderer_host/test/test_render_view_host.h" 10 #include "chrome/browser/renderer_host/test/test_render_view_host.h"
11 #include "chrome/browser/tab_contents/test_tab_contents.h" 11 #include "chrome/browser/tab_contents/test_tab_contents.h"
12 #include "chrome/browser/profile.h" 12 #include "chrome/browser/profile.h"
13 #import "testing/gtest_mac.h"
13 14
14 namespace { 15 namespace {
15 16
16 class BugReportWindowControllerUnittest : public RenderViewHostTestHarness { 17 class BugReportWindowControllerUnittest : public RenderViewHostTestHarness {
17 }; 18 };
18 19
19 // See http://crbug.com/29019 for why it's disabled. 20 // See http://crbug.com/29019 for why it's disabled.
20 TEST_F(BugReportWindowControllerUnittest, DISABLED_ReportBugWithNewTabPageOpen) { 21 TEST_F(BugReportWindowControllerUnittest, DISABLED_ReportBugWithNewTabPageOpen) {
21 ChromeThread ui_thread(ChromeThread::UI, MessageLoop::current()); 22 ChromeThread ui_thread(ChromeThread::UI, MessageLoop::current());
22 // Create a "chrome://newtab" test tab. SiteInstance will be deleted when 23 // Create a "chrome://newtab" test tab. SiteInstance will be deleted when
23 // tabContents is deleted. 24 // tabContents is deleted.
24 SiteInstance* instance = 25 SiteInstance* instance =
25 SiteInstance::CreateSiteInstance(profile_.get()); 26 SiteInstance::CreateSiteInstance(profile_.get());
26 TestTabContents* tabContents = new TestTabContents(profile_.get(), 27 TestTabContents* tabContents = new TestTabContents(profile_.get(),
27 instance); 28 instance);
28 tabContents->controller().LoadURL(GURL("chrome://newtab"), 29 tabContents->controller().LoadURL(GURL("chrome://newtab"),
29 GURL(), PageTransition::START_PAGE); 30 GURL(), PageTransition::START_PAGE);
30 31
31 BugReportWindowController* controller = [[BugReportWindowController alloc] 32 BugReportWindowController* controller = [[BugReportWindowController alloc]
32 initWithTabContents:tabContents 33 initWithTabContents:tabContents
33 profile:profile_.get()]; 34 profile:profile_.get()];
34 35
35 // The phishing report bug is stored at index 2 in the Report Bug dialog. 36 // The phishing report bug is stored at index 2 in the Report Bug dialog.
36 [controller setBugTypeIndex:2]; 37 [controller setBugTypeIndex:2];
37 EXPECT_TRUE([controller isPhishingReport]); 38 EXPECT_TRUE([controller isPhishingReport]);
38 [controller setBugTypeIndex:1]; 39 [controller setBugTypeIndex:1];
39 EXPECT_FALSE([controller isPhishingReport]); 40 EXPECT_FALSE([controller isPhishingReport]);
40 41
41 // Make sure that the tab was correctly recorded. 42 // Make sure that the tab was correctly recorded.
42 EXPECT_TRUE([[controller pageURL] isEqualToString:@"chrome://newtab/"]); 43 EXPECT_NSEQ(@"chrome://newtab/", [controller pageURL]);
43 EXPECT_TRUE([[controller pageTitle] isEqualToString:@"New Tab"]); 44 EXPECT_NSEQ(@"New Tab", [controller pageTitle]);
44 45
45 // When we call "report bug" with non-empty tab contents, all menu options 46 // When we call "report bug" with non-empty tab contents, all menu options
46 // should be available, and we should send screenshot by default. 47 // should be available, and we should send screenshot by default.
47 EXPECT_EQ([[controller bugTypeList] count], 8U); 48 EXPECT_EQ([[controller bugTypeList] count], 8U);
48 EXPECT_TRUE([controller sendScreenshot]); 49 EXPECT_TRUE([controller sendScreenshot]);
49 50
50 delete tabContents; 51 delete tabContents;
51 [controller release]; 52 [controller release];
52 } 53 }
53 54
(...skipping 12 matching lines...) Expand all
66 // that don't refer to a specific page should be available, and the send 67 // that don't refer to a specific page should be available, and the send
67 // screenshot option should be turned off. 68 // screenshot option should be turned off.
68 EXPECT_EQ([[controller bugTypeList] count], 4U); 69 EXPECT_EQ([[controller bugTypeList] count], 4U);
69 EXPECT_FALSE([controller sendScreenshot]); 70 EXPECT_FALSE([controller sendScreenshot]);
70 71
71 [controller release]; 72 [controller release];
72 } 73 }
73 74
74 } // namespace 75 } // namespace
75 76
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698