summaryrefslogtreecommitdiffstats
path: root/ceee/ie/testing/ie_unittest_main.cc
blob: 2317472fd3cd215418f6b4c45677fe184ab2310d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright (c) 2010 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.
//
// Main function for common unittests.
#include <atlbase.h>
#include <atlcom.h>
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/logging.h"
#include "ceee/testing/utils/gflag_utils.h"
#include "chrome/common/url_constants.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"

#include "toolband.h"  // NOLINT

// Stub for unittesting.
namespace ceee_module_util {

LONG LockModule() {
  return 0;
}
LONG UnlockModule() {
  return 0;
}
void Lock() {
}
void Unlock() {
}
void AddRefModuleWorkerThread() {
}
void ReleaseModuleWorkerThread() {
}

// Fires an event to the broker, so that the call can be made with an
// instance of a broker proxy that was CoCreated in the worker thread.
void FireEventToBroker(const std::string& event_name,
                       const std::string& event_args) {
  // Must get some work done so that the function can be mocked.
  // Otherwise, it would be too short to be side stepped...
  if (event_name == event_args) {
    CHECK(event_name == event_args);
  } else {
    CHECK(event_name != event_args);
  }
}

}  // namespace ceee_module_util


// We're testing ATL code that requires a module object.
class ObligatoryModule: public CAtlDllModuleT<ObligatoryModule> {
 public:
  DECLARE_LIBID(LIBID_ToolbandLib);
};

ObligatoryModule g_obligatory_atl_module;

// Run these tests under page heap.
const DWORD kGFlags = FLG_USER_STACK_TRACE_DB | FLG_HEAP_PAGE_ALLOCS;

int main(int argc, char **argv) {
  // Disabled, bb2560934.
  // if (!IsDebuggerPresent())
  //   testing::RelaunchWithGFlags(kTestGFlags);

  base::AtExitManager at_exit;
  CommandLine::Init(argc, argv);

  // Needs to be called before we can use GURL.
  chrome::RegisterChromeSchemes();

  testing::InitGoogleMock(&argc, argv);
  testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}