OLD | NEW |
| (Empty) |
1 // Copyright 2010 Google Inc. | |
2 // | |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 // you may not use this file except in compliance with the License. | |
5 // You may obtain a copy of the License at | |
6 // | |
7 // http://www.apache.org/licenses/LICENSE-2.0 | |
8 // | |
9 // Unless required by applicable law or agreed to in writing, software | |
10 // distributed under the License is distributed on an "AS IS" BASIS, | |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 // See the License for the specific language governing permissions and | |
13 // limitations under the License. | |
14 // ======================================================================== | |
15 | |
16 #include <windows.h> | |
17 #include "omaha/base/app_util.h" | |
18 #include "omaha/goopdate/resource_manager.h" | |
19 #include "omaha/testing/unit_test.h" | |
20 #include "omaha/ui/yes_no_dialog.h" | |
21 | |
22 namespace omaha { | |
23 | |
24 class YesNoDialogTest : public testing::Test { | |
25 protected: | |
26 YesNoDialogTest() {} | |
27 | |
28 static void SetUpTestCase() { | |
29 CString resource_dir = app_util::GetModuleDirectory(NULL); | |
30 EXPECT_HRESULT_SUCCEEDED( | |
31 ResourceManager::Create(false, resource_dir, _T("en"))); | |
32 } | |
33 | |
34 static void TearDownTestCase() { | |
35 ResourceManager::Delete(); | |
36 } | |
37 | |
38 static void SendCloseMessage(const YesNoDialog& yes_no_dialog) { | |
39 EXPECT_TRUE(yes_no_dialog.IsWindow()); | |
40 ::SendMessage(yes_no_dialog.m_hWnd, WM_CLOSE, 0, 0); | |
41 } | |
42 }; | |
43 | |
44 TEST_F(YesNoDialogTest, YesNoDialog) { | |
45 CString title(_T("YesNoDialog")); | |
46 CString text(_T("This is a test. Continue?")); | |
47 | |
48 CMessageLoop message_loop; | |
49 YesNoDialog yes_no_dialog(&message_loop, NULL); | |
50 EXPECT_SUCCEEDED(yes_no_dialog.Initialize(title, text)); | |
51 EXPECT_SUCCEEDED(yes_no_dialog.Show()); | |
52 YesNoDialogTest::SendCloseMessage(yes_no_dialog); | |
53 } | |
54 | |
55 } // namespace omaha | |
56 | |
OLD | NEW |